forked from nus-cs2103-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into convertlead
- Loading branch information
Showing
37 changed files
with
619 additions
and
63 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 |
---|---|---|
|
@@ -41,37 +41,74 @@ Here are some descriptions of the words we use throughout the User Guide: | |
|
||
![Ui1](images/Ui1.png) | ||
|
||
## Lead features | ||
|
||
### Add lead [Coming soon] | ||
### Add lead | ||
|
||
- What it does: Add potential leads and their basic information, e.g. name, age, year of study, major, etc. | ||
- Command format: `add --name <name> --age <age> --year <year of study> --major <major>`. | ||
- Example usage: `add --name Dave --age 22 --year 2 --major Psychology`. | ||
- Command format: `addlead n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...`. | ||
- Example usage: `Example: addlead n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/classmate`. | ||
- Acceptable values for each parameter: | ||
- `NAME`: can contain any character. | ||
- `PHONE`: any valid 8-digit integer. | ||
- `EMAIL`: a string of the format `local-part@domain` | ||
- `ADDRESS`: can contain any character. | ||
- `TAG`: can contain any character. | ||
- Precise expected outputs when the command succeeds: | ||
|
||
<div align="center"> | ||
<img src="./images/addlead.png" width="500" /> | ||
<p>After using addlead command</p> | ||
</div> | ||
|
||
- Precise expected outputs when the command fails: | ||
|
||
``` | ||
Invalid command format! | ||
addlead: Adds a lead to the address book. Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]... | ||
Example: addlead n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/classmate | ||
``` | ||
|
||
### Add Client | ||
- What it does: Add potential clients and their basic information, e.g. name, age, year of study, major, etc. | ||
- Command format: `addclient n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...`. | ||
- Example usage: `Example: addclient n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/classmate`. | ||
- Acceptable values for each parameter: | ||
- `name`: can contain any character, up to 100 characters long. | ||
- `age`: any integer between `1` and `100` inclusive. | ||
- `year`: any integer between `1` and `5` inclusive. | ||
- `major`: can contain any character, up to 50 characters long. | ||
- `NAME`: can contain any character. | ||
- `PHONE`: any valid 8-digit integer. | ||
- `EMAIL`: a string of the format `local-part@domain` | ||
- `ADDRESS`: can contain any character. | ||
- `TAG`: can contain any character. | ||
- Precise expected outputs when the command succeeds: | ||
|
||
`Lead added. <lead details>` | ||
<div align="center"> | ||
<img src="./images/addclient.png" width="500" /> | ||
<p>After using addclient command</p> | ||
</div> | ||
|
||
- Precise expected outputs when the command fails: | ||
|
||
`Lead failed to add. Please enter a valid command` | ||
``` | ||
Invalid command format! | ||
addclient: Adds a client to the address book. Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]... | ||
Example: addclient n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/classmate | ||
``` | ||
|
||
### View all clients | ||
|
||
- What it does: View all clients you have stored, including their basic information and index in the list of leads, e.g. id, name, age, gender, occupation, etc. | ||
- What it does: View all clients you have stored, including their basic information and index in the list of clients, e.g. id, name, age, gender, occupation, etc. | ||
- Command: `listclient`. | ||
- Precise expected outputs when the command succeeds: | ||
|
||
In output section of the | ||
`List of all clients` | ||
|
||
- Precise expected outputs when the command fails: | ||
<h4>Examples of usage:</h4> | ||
|
||
`Failed to view all clients. Please enter a valid command` | ||
<div align="center"> | ||
<img src="./images/List.png" width="500" /> | ||
<p>List of leads and clients</p> | ||
<img src="./images/Listclient.png" width="500" /> | ||
<p>After using listclient command</p> | ||
</div> | ||
|
||
### View all leads | ||
|
||
|
@@ -81,36 +118,46 @@ Here are some descriptions of the words we use throughout the User Guide: | |
|
||
`List of all leads` | ||
|
||
- Precise expected outputs when the command fails: | ||
<h4>Example usage:<h4> | ||
|
||
<div align="center"> | ||
<img src="./images/List.png" width = "500"/> | ||
<p>List of leads and clients</p> | ||
<img src="./images/Listlead.png" width = "500"/> | ||
<p>After using listlead command</p> | ||
</div> | ||
|
||
`Failed to view all leads. Please enter a valid command` | ||
|
||
### Delete lead [Coming soon] | ||
### Delete [Coming soon] | ||
|
||
- What it does: Deletes a lead from your list of leads. | ||
- Command format: `delete --id <id>`. | ||
- Example usage: `delete --id 1`. | ||
- Acceptable values for `id` parameter: | ||
- Command format: `delete INDEX`. | ||
- Example usage: `delete 1`. | ||
- Acceptable values for `INDEX` parameter: | ||
- Must be an integer from `1` to the last index of the leads list | ||
- Precise expected outputs when the command succeeds: | ||
|
||
`Lead deleted: <lead details>` | ||
|
||
- Precise expected outputs when the command fails: | ||
|
||
`Lead failed to delete. Please enter a valid lead id` | ||
``` | ||
Invalid command format! | ||
delete: Deletes the person identified by the index number used in the displayed person list. | ||
Parameters: INDEX (must be a positive integer) | ||
``` | ||
|
||
### Add meeting time for lead [Coming soon] | ||
### Add meeting time [Coming soon] | ||
|
||
- What it does: Adds a meeting time for a lead | ||
- Command format: `addmeeting --lead <lead_id> --dt <datetime>` | ||
- Example usage: `addmeeting --lead 1 --dt 23/9/2023 5:30PM` | ||
- Command format: `addmeetingtime INDEX m/MEETING_TIME` | ||
- Example usage: `addmeetingtime 1 m/12/12/2020 12:00` | ||
- Acceptable values for each parameter: | ||
- `lead`: Any integer from `1` to the last index of the leads list | ||
- `dt`: A valid DateTime String with the format dd/M/yyyy hh:mma. | ||
- `INDEX`: Any integer from `1` to the last index of the leads list. | ||
- `MEETING_TIME`: A string of format `dd/MM/yyyy HH:mm`. | ||
- Precise expected outputs when the command succeeds: | ||
|
||
`Meeting time added to <lead> : <meeting datetime>` | ||
`Meeting time added to <lead/client> : <meeting datetime>` | ||
|
||
- Precise expected outputs when the command fails: | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
70 changes: 70 additions & 0 deletions
70
src/main/java/seedu/address/logic/commands/ViewCommand.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,70 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import seedu.address.commons.core.LogsCenter; | ||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.Messages; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
|
||
/** | ||
* Views specified person based on input index. | ||
*/ | ||
public class ViewCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "view"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Viewed Person Successfully"; | ||
private static final String state = "view"; | ||
|
||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Views the person identified by the index number used.\n" | ||
+ "Parameters: INDEX (must be a positive integer)\n" | ||
+ "Example: " + COMMAND_WORD + " 1"; | ||
|
||
private static final Logger logger = LogsCenter.getLogger(ViewCommand.class); | ||
|
||
private final Index targetIndex; | ||
|
||
public ViewCommand(Index targetIndex) { | ||
this.targetIndex = targetIndex; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
|
||
if (targetIndex.getZeroBased() < 0 || targetIndex.getZeroBased() >= model.getFilteredPersonList().size()) { | ||
logger.info(targetIndex.getZeroBased() + "+ " + model.getFilteredPersonList().size()); | ||
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); | ||
} | ||
|
||
Person personToView = model.getFilteredPersonList().get(targetIndex.getZeroBased()); | ||
model.view(personToView); | ||
|
||
logger.info("Target Index: " + targetIndex.getZeroBased()); | ||
logger.info("Client to View: " + personToView); | ||
return new CommandResult(MESSAGE_SUCCESS, false, false, "view"); | ||
} | ||
@Override | ||
public boolean equals(Object other) { | ||
if (this == other) { | ||
return true; | ||
} | ||
|
||
if (other == null || getClass() != other.getClass()) { | ||
return false; | ||
} | ||
|
||
ViewCommand that = (ViewCommand) other; | ||
|
||
return targetIndex.equals(that.targetIndex); | ||
} | ||
} | ||
|
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
29 changes: 29 additions & 0 deletions
29
src/main/java/seedu/address/logic/parser/ViewCommandParser.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,29 @@ | ||
package seedu.address.logic.parser; | ||
|
||
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; | ||
|
||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.commands.ViewCommand; | ||
import seedu.address.logic.parser.exceptions.ParseException; | ||
|
||
/** | ||
* Parses input arguments and creates a new ViewCommand object | ||
*/ | ||
public class ViewCommandParser implements Parser<ViewCommand> { | ||
|
||
/** | ||
* Parses the given {@code String} of arguments in the context of the ViewCommand | ||
* and returns a ViewCommand object for execution. | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public ViewCommand parse(String args) throws ParseException { | ||
try { | ||
Index index = ParserUtil.parseIndex(args); | ||
return new ViewCommand(index); | ||
} catch (ParseException pe) { | ||
throw new ParseException( | ||
String.format(MESSAGE_INVALID_COMMAND_FORMAT, ViewCommand.MESSAGE_USAGE), pe); | ||
} | ||
} | ||
|
||
} |
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.