Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CS2103-AY1819S1-F10-2/main
Browse files Browse the repository at this point in the history
…into add-status-to-tag
  • Loading branch information
prokarius committed Nov 1, 2018
2 parents c1a6e89 + cac2c66 commit 96c6c46
Show file tree
Hide file tree
Showing 92 changed files with 1,804 additions and 912 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
}

shadowJar {
archiveName = 'addressbook.jar'
archiveName = 'loanbook.jar'

destinationDir = file("${buildDir}/jar/")
}
Expand Down
342 changes: 284 additions & 58 deletions docs/DeveloperGuide.adoc

Large diffs are not rendered by default.

121 changes: 102 additions & 19 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ e.g. typing *`help`* and pressing kbd:[ENTER] will open the help window.

* *`list`* : List the status of the loanbook
* **`add`**`p/John hp/12345678 e/john@abc.com r/3 o/Bicycle-007` : Loans Bicycle-007 to John at a rate of $3 per hour
* **`delete`**`3` : deletes the 3rd loan shown in the current list
* **`delete`**`i/3 x/a12345` : deletes the 3rd loan shown in the current list
* *`reset`* : Reset the loanbook

[NOTE]
The default password for the app is `a12345`. This is required for some commands such as `reset` and `delete`.

. Refer to <<Features>> for details of each command.

[[Features]]
Expand All @@ -48,14 +51,21 @@ e.g. typing *`help`* and pressing kbd:[ENTER] will open the help window.
=== Viewing help : `help`

Provides a list of all commands together with a basic description, how-to-use and example usage for each command. +

[NOTE]
This will cause a pop up window to appear, containing a copy of this User Guide.

[TIP]
This is not the only way to get help! If you key in the commands with the wrong format, you will get a prompt in the display box which will give you a brief description of the command. It will also tell you how to use the command correctly.

Format: `help`

=== Adding a loan: `add`

Adds a loan to the loan book with the following parameters, and displays the transaction along with a LOAN_ID to keep track of the loan. +
Format: `add p/PERSON_NAME hp/PERSON_PHONE_NO e/PERSON_EMAIL r/RATE o/OBJECT_IDENTITY`

[TIP]
[NOTE]
NUMBER_LOANED and LOAN_OUT_PERIOD must be a positive integer
RATE is in dollars per hour.
PERSON_PHONE_NO and PERSON_EMAIL should not be blank.
Expand All @@ -65,6 +75,11 @@ Examples:
* `add p/John hp/97626753 e/johnw@abc.com r/5 o/Bicycle-007`
* `add p/James Tan hp/86661352 e/alabaaoe@xyz.com r/144 o/Bicycle-007`

[TIP]
====
The best part about this is you do not even need to key in the time that you created this loan! LoanBook does the timing for you! Simple isn't it?
====

=== Listing all loans : `list`

Shows a list of all loans in the LoanBook. +
Expand All @@ -73,26 +88,31 @@ Format: `list`
=== Editing a loan : `edit`

In case a wrong entry is keyed in, or the customer changes their mind, this command allows details of a loan entry to be edited. +
Format: `edit i/LOAN_ID [p/PERSON_NAME] [hp/PERSON_PHONE_NO] [e/PERSON_EMAIL] [r/RATE] [o/OBJECT_IDENTITY]`
Format: `edit i/LOAN_INDEX [p/PERSON_NAME] [hp/PERSON_PHONE_NO] [e/PERSON_EMAIL] [r/RATE] [o/OBJECT_IDENTITY]`

****
* Edits the loan at the specified `LOAN_ID`. This LOAN_ID refers to the LOAN_ID number shown in the displayed loan list. The LOAN_ID *must be a positive integer* 1, 2, 3, ...
* Edits the loan at the specified `LOAN_INDEX`. This LOAN_INDEX refers to the LOAN_INDEX number shown in the displayed loan list. The LOAN_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 loan will be removed i.e adding of tags is not cumulative.
****

Examples:

* `edit i/11037 o/Bicycle-017` +
For the loan with Loan ID 11037, changes the loaned object from whatever it was before to Bicycle-017.
* `edit i/90210 p/James Tan hp/86661352 e/alabaaoe@xyz.com r/144` +
For the loan with Loan ID 90210, changes the customer to James Tan, who has the specified contact details, to the rate of $144 per hour.
* `edit i/11 o/Bicycle-017` +
For the loan at index 11, changes the loaned object from whatever it was before to Bicycle-017.
* `edit i/9 p/James Tan hp/86661352 e/alabaaoe@xyz.com r/144` +
For the loan at index 9, changes the customer to James Tan, who has the specified contact details, to the rate of $144 per hour.

[NOTE]
====
We do not allow editing of the loan's start time or the return time because we want you to be able to use our application as an auditing tool. We hope that this can then simplify the management of your business.
====

=== Locating loans by key words: `search`

Returns a loan based on parameters of LOAN_ID, PERSON_NAME or OBJECT_IDENTITY. +
Format: `search [i/LOAN_ID] [p/PERSON_NAME] [o/OBJECT_IDENTITY]`
Returns a loan based on parameters of LOAN_INDEX, PERSON_NAME or OBJECT_IDENTITY. +
Format: `search [i/LOAN_INDEX] [p/PERSON_NAME] [o/OBJECT_IDENTITY]`

****
* The search is case insensitive. e.g `hans` will match `Hans`
Expand All @@ -104,20 +124,20 @@ Format: `search [i/LOAN_ID] [p/PERSON_NAME] [o/OBJECT_IDENTITY]`
Examples:

* `search i/11037` +
Searches for the loan with LOAN_ID 11037
Searches for the loan with LOAN_INDEX 11037
* `search p/James Tan` +
Searches for loans made by James Tan
* `search p/John Doe o/Bicycle-007` +
Searches for loans made by John Doe where the item loaned out is Bicycle-007

=== Deleting the chosen loan from the loan book : `delete`

Delete the loan from the loan book. If you want to delete one loan, use `delete i/LOAN_ID x/CURRENT_PASSWORD`.
Delete the loan from the loan book. If you want to delete one loan, use `delete i/LOAN_INDEX x/CURRENT_PASSWORD`.
Due to `delete` modifying transectional summery, it is a critical command and hence elevation is required hence the password field. +
Format: `delete i/LOAN_ID x/CURRENT_PASSWORD`
Format: `delete i/LOAN_INDEX x/CURRENT_PASSWORD`

****
* Deletes the loan at the specified `i/LOAN_ID`.
* Deletes the loan at the specified `i/LOAN_INDEX`.
* Note that this does not reset `LOAN_ID`.
* Deletion will not occur if `CURRENT_PASSWORD` is incorrect.
****
Expand All @@ -130,7 +150,7 @@ The default password for the app is `a12345`.
Examples:

* `delete i/11037 x/a12345` +
Deletes the loan with LOAN_ID 11037.
Deletes the loan with that has been indexed at position 11037.

=== Changing the password of the app: `setpass`

Expand All @@ -149,13 +169,35 @@ Set the password of the app to `n3wP4sS`.

=== Returning a loan : `return`

Marks a loan as returned based on LOAN_ID and automatically prints out the amount payable. +
Format: `return i/LOAN_ID`
What's the use of a LoanBook if you are unable to return the loans that you have? This is how you can do that! In fact, we see your pains trying to calculate the amount payable on a calculator, so we decided to help you out by doing all the number crunching for you.

This command marks a loan as returned based on LOAN_INDEX and automatically prints out the amount payable. The amount payable will be prorated and rounded down to the nearest minute. +

[TIP]
====
We choose to do this because when we get down to seconds, the difference in the earnings you will get is going to be on the order of fraction of cents. We hope that by doing this, your business would not seem to be very petty about the money.
Also, this would be good for your business, as customers will not feel that they have been ripped off the cost of renting a bike for an extra minute just because you took 5 seconds to log their return details! :)
====

Do note that you will have to list out all the loans in order, or search for a particular loan that you would like to return. From there, you need to key in the index number of the loan as a parameter into this command.

Format: `return i/LOAN_INDEX`

[NOTE]
Do be careful to note that it is the loan INDEX that you are keying into the program. Please do not key in the LoanID instead!

[WARNING]
====
This command is currently not undoable. Please be careful to double check.
We are working on fixing this issue! Do look forward to seeing this new functionality in the next release of LoanBook, version 2.0!
====

Examples:

* `return i/11037` +
Marks the loan with LOAN_ID 11037 as returned. Also automatically prints out the amount payable based on loan time and rate.
Marks the loan with LOAN_INDEX 11037 as returned. Also automatically prints out the amount payable based on loan time and rate.

=== Hard reset the entire loan book : `reset`

Expand All @@ -174,7 +216,9 @@ The difference between deleting all the loans and hard resetting the LoanBook is

=== Summarize all the transactions : `summary`

Show the total number of loans that are done and in progress. Also summarizes the loan status of each item, the number of times an object was loaned before.
Do you want to find out at a glance how much money your business has collected? Or maybe out of all the bicycles you have, how many are currently loaned out? Here's the command for you.

This feature shows the total number of loans that are done and in progress. It also summarizes the loan status of each item, the number of times an object was loaned before.

The `summary` function would display the statistics of all your loans in the display box on the right of the application. There, you will find the following statistics:

Expand All @@ -200,6 +244,45 @@ Format: `history`
Pressing the kbd:[&uarr;] and kbd:[&darr;] arrows will display the previous and next input respectively in the command box.
====

=== Check your email : `checkemail`

Checks whether you have set your email or not, and displays the censored email address if you have set it before. +
Format: `checkemail`

=== Set your email : `setemail`

Sets the email address to send reminder emails from. +
Format: `setemail OLDEMAIL NEWEMAIL`

* `OLDEMAIL` is `default` if you have not set an email yet.
* `OLDEMAIL` must be the same as the one you set last time.
* `NEWEMAIL` cannot the same as `OLDEMAIL`.
* `NEWEMAIL` must be a valid gmail.

[NOTE]
Only gmail is accepted!

Examples:

* `setemail default \new_email@gmail.com`
* `setemail \old_email@gmail.com \new_email@gmail.com`

=== send reminder email : `remind`

Sends a reminder email to the customer. +
Format: `remind x/EMAILPASSWORD n/NAME b/BIKE`

* `NAME` and `BIKE` must be from the same `ONGOING` loan.
* `EMAILPASSWORD` must be correct.

[NOTE]
*[IMPORTANT] Before using this command, please go to* https://www.google.com/settings/security/lesssecureapps[Less Secure Apps] *, enable it and refresh the Settings page!*

Examples:

* `remind x/123456 n/Alex b/Bike001`
* `remind x/nscjhbdhv n/Peter Lee b/NewBike`

=== Non-functional features :
* Aliases to allow users to use the CLI with less keystrokes.
* Chainable commands. I.e. allow adding and deleting of items asynchronously.
Expand Down
Binary file added docs/diagrams/CheckEmailSequenceDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/ModelComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/StorageComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/UiComponentClassDiagram.pptx
Binary file not shown.
Binary file added docs/images/CheckEmailSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/DeleteLoanSdForLogic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/ModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/SDforDeleteLoan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/StorageClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/UiClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package loanbook.commons.events.ui;

import loanbook.model.bike.Bike;

/**
* Represents a selection change in the Bike List Panel.
*/
public class BikeListPanelSelectionChangedEvent extends ListPanelSelectionChangedEvent<Bike> {

public BikeListPanelSelectionChangedEvent(Bike newSelection) {
super(newSelection);
}

}
14 changes: 14 additions & 0 deletions src/main/java/loanbook/commons/events/ui/BikeListShowEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package loanbook.commons.events.ui;

import loanbook.commons.events.BaseEvent;

/**
* Represents a request to change the List Panel to view bikes.
*/
public class BikeListShowEvent extends BaseEvent {

@Override
public String toString() {
return getClass().getSimpleName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package loanbook.commons.events.ui;

import loanbook.commons.events.BaseEvent;

/**
* Represents a selection change in the List Panel.
*/
public class ListPanelSelectionChangedEvent<T> extends BaseEvent {

private final T newSelection;

public ListPanelSelectionChangedEvent(T newSelection) {
this.newSelection = newSelection;
}

@Override
public String toString() {
return getClass().getSimpleName();
}

public T getNewSelection() {
return newSelection;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package loanbook.commons.events.ui;

import loanbook.model.loan.Loan;

/**
* Represents a selection change in the Loan List Panel.
*/
public class LoanListPanelSelectionChangedEvent extends ListPanelSelectionChangedEvent<Loan> {

public LoanListPanelSelectionChangedEvent(Loan newSelection) {
super(newSelection);
}

}
14 changes: 14 additions & 0 deletions src/main/java/loanbook/commons/events/ui/LoanListShowEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package loanbook.commons.events.ui;

import loanbook.commons.events.BaseEvent;

/**
* Represents a request to change the List Panel to view loans.
*/
public class LoanListShowEvent extends BaseEvent {

@Override
public String toString() {
return getClass().getSimpleName();
}
}

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/loanbook/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import loanbook.logic.commands.CommandResult;
import loanbook.logic.commands.exceptions.CommandException;
import loanbook.logic.parser.exceptions.ParseException;
import loanbook.model.bike.Bike;
import loanbook.model.loan.Loan;

/**
Expand All @@ -19,6 +20,9 @@ public interface Logic {
*/
CommandResult execute(String commandText) throws CommandException, ParseException;

/** Returns an unmodifiable view of the filtered list of bikes */
ObservableList<Bike> getFilteredBikeList();

/** Returns an unmodifiable view of the filtered list of loans */
ObservableList<Loan> getFilteredLoanList();

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/loanbook/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import loanbook.logic.parser.LoanBookParser;
import loanbook.logic.parser.exceptions.ParseException;
import loanbook.model.Model;
import loanbook.model.bike.Bike;
import loanbook.model.loan.Loan;

/**
Expand Down Expand Up @@ -40,6 +41,11 @@ public CommandResult execute(String commandText) throws CommandException, ParseE
}
}

@Override
public ObservableList<Bike> getFilteredBikeList() {
return model.getFilteredBikeList();
}

@Override
public ObservableList<Loan> getFilteredLoanList() {
return model.getFilteredLoanList();
Expand Down
Loading

0 comments on commit 96c6c46

Please sign in to comment.