diff --git a/data/duke.txt b/data/duke.txt index e69de29bb2..3ddf98e707 100644 Binary files a/data/duke.txt and b/data/duke.txt differ diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index 78aa2a6b87..4ea49678d0 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -4,7 +4,7 @@ :imagesDir: images :stylesDir: stylesheets -Duke - mid v1.1 was developed by the CS2113T-F10-3 team. + +AlphaNUS - mid v1.1 was developed by the CS2113T-F10-3 team. + _{The dummy content given below serves as a placeholder to be used by future forks of the project.}_ + {empty} + We are a team based in the http://www.comp.nus.edu.sg[School of Computing, National University of Singapore]. @@ -38,7 +38,7 @@ Responsibilities: Data ''' === Li Jiayu -image::dummy.png[width="150", align="left"] +image::lijiayu980606.png[width="150", align="left"] {empty}[http://github.com/lijiayu980606[github]] [<>] Role: Deliverables and deadlines, Integration + @@ -47,7 +47,7 @@ Responsibilities: Storage ''' === Karan Sarat -image::dummy.png[width="150", align="left"] +image::karansarant.png[width="150", align="left"] {empty}[http://github.com/karansarat[github]] [<>] Role: Scheduling and tracking, + diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc new file mode 100644 index 0000000000..9de035db11 --- /dev/null +++ b/docs/DeveloperGuide.adoc @@ -0,0 +1,252 @@ += AlphaNUS - Developer Guide +:site-section: DeveloperGuide +:toc: +:toc-title: +:toc-placement: preamble +:sectnums: +:imagesDir: images +:stylesDir: stylesheets +:xrefstyle: full +ifdef::env-github[] +:tip-caption: :bulb: +:note-caption: :information_source: +:warning-caption: :warning: +endif::[] +:repoURL: https://github.com/se-edu/addressbook-level3/tree/master + +By: `AY1920S1-CS2113T-F10-3` Since: `Aug 2019` Licence: `NUS` + +[appendix] +== Product Scope + +*Target user profile*: + +* has a need to manage a significant number of payment forms +* prefer desktop apps over other types +* can type fast +* prefers typing over mouse input +* is reasonably comfortable using CLI apps + +*Value proposition*: Manage payments faster than a typical mouse/GUI driven app + +[appendix] +== User Stories + +Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (unlikely to have) - `*` + +[width="59%",cols="22%,<23%,<25%,<30%",options="header",] +|======================================================================= +|Priority |As a ... |I want to ... |So that I can... +|`* * *` |new user |see usage instructions |refer to instructions when I forget how to use the App + +|`* * *` |NUS Treasurer |add the budget for an event |spend within my budget + +|`* * *` |NUS Treasurer |add my deadlines |keep track of the payments to be submitted + +|`* *` |NUS Treasurer |set priorities for each deadline |decide which task to finish first + +|`* *` |NUS Treasurer |view the amount of money remaining from my budget |budget my spending better + +|`* *` |NUS Treasurer |edit my forms easily |correct any mistakes i make + +|`* *` |NUS Treasurer |delete my forms easily |correct any mistakes i make + +|`* *` |NUS Treasurer |find my forms easily |locate details of an event without going through the whole list + +|`* *` |NUS Treasurer |approve my payment forms |track which payment forms have been approved + +|`*` |NUS Treasurer |categorise the payment forms I submitted into projects |keep track of the payment forms belonging to a particular project + +|`*` |NUS Treasurer |share my payment forms |get approval from my superiors +|======================================================================= + +[appendix] +== Use Cases + +(For all use cases below, the *System* is `AlphaNUS` and the *Actor* is the `NUS Treasurer`, unless specified otherwise) + +=== Use case: Add a new deadline + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User types in the command line the deadline description and time. +4. AlphaNUS adds the deadline. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in an invalid deadline command. +** 3a1. AlphaNUS shows an error message and the correct deadline input format. ++ +Use case ends. + +=== Use case: Add a new payment form + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User types in the command line the payment description, items and the cost of each item. +4. AlphaNUS adds the payment form. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in an invalid payment command. +** 3a1. AlphaNUS shows an error message and the correct payment input format. ++ +Use case ends. + +=== Use case: Find a payment form or deadline + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User types in the command line the command to find and a keyword containing part of the description of a deadline or payment form. +4. AlphaNUS lists the deadlines and payment forms with descriptions that matches the keyword. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in an invalid find command. +** 3a1. AlphaNUS shows an error message and the correct find input format. ++ +Use case ends. + +[none] +* 3b. User types in a keyword that returns no match. +** 3b1. AlphaNUS shows a no-match error message. ++ +Use case ends. + +=== Use case: Edit the description of a payment form or a deadline + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User types in command line the command to edit a payment form or deadline with a new description. +4. AlphaNUS updates the payment form/deadline with the new description. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in a non-existing id. +** 3a1. AlphaNUS shows a non-existing id error message. ++ +Use case ends. + +=== Use case: Edit the time of a deadline + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User requests to reschedule a deadline to a new time. +4. AlphaNUS updates the deadline with the new time. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in a non-existing id for a deadline. +** 3a1. AlphaNUS shows a non-existing id error message. ++ +Use case ends. + +[none] +* 3b. User types in an invalid time. +** 3b1. AlphaNUS shows an invalid time error message. ++ +Use case ends. + +[none] +* 3c. User requests to snooze the deadline. +** 3c1. AlphaNUS snoozes the deadline by 1 hour. ++ +Use case ends. + +[none] +* 3d. User requests to [.underline]#find the deadline# first. +** 3d1. AlphaNUS lists the deadlines that match the keyword searched. ++ +Use case resumes from step 3. + +=== Use case: Edit the <> of a payment form + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User requests to redetail a payment form. +4. AlphaNUS updates the payment form with its new payment details. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in a non-existing id for a payment form. +** 3a1. AlphaNUS shows a non-existing id error message. ++ +Use case ends. + +[none] +* 3d. User requests to [.underline]#find the payment form# first. +** 3d1. AlphaNUS lists the payment forms that match the keyword searched. ++ +Use case resumes from step 3. + + +=== Use case: Approve a payment form + +*MSS* + +1. User opens the JAR file. +2. AlphaNUS shows a command line along with different sections such as “Deadlines”, “Payments” and “Payment History”. +3. User requests to approve a payment form. +4. AlphaNUS sets the payment form to approved. ++ +Use case ends. + +*Extensions* + +[none] +* 3a. User types in a non-existing id for a payment form. +** 3a1. AlphaNUS shows a non-existing id error message. ++ +Use case ends. + +[none] +* 3d. User requests to [.underline]#find the payment form# first. +** 3d1. AlphaNUS lists the payment forms that match the keyword searched. ++ +Use case resumes from step 3. + +[appendix] +== Non Functional Requirements + +. Should work on any <> as long as it has Java `11` or above installed. +. Should be able to support up to 1000 payment forms and deadlines without a noticeable sluggishness in performance for typical usage. +. A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse. + +[appendix] +== Glossary + +[[mainstream-os]] Mainstream OS:: +Windows, Linux, Unix, OS-X + +[[payment-details]] Payment Details:: +The item name and its cost in a payment form. \ No newline at end of file diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc new file mode 100644 index 0000000000..20c1e7fbdd --- /dev/null +++ b/docs/UserGuide.adoc @@ -0,0 +1,225 @@ += AlphaNUS - User Guide +:site-section: UserGuide +:toc: +:toc-title: +:toc-placement: preamble +:sectnums: +:imagesDir: images +:stylesDir: stylesheets +:xrefstyle: full +:experimental: +ifdef::env-github[] +:tip-caption: :bulb: +:note-caption: :information_source: +endif::[] +:repoURL: https://github.com/AY1920S1-CS2113T-F10-3/main + +By: `Team F10-3` Since: `Aug 2019` + +== Introduction + +AlphaNUS is a personal assistant for NUS club treasurers to easily manage their payment forms to be submitted. + +== Quick Start +. Some example commands you can try: + +* *`list`* : lists all tasks +* **`delete`**`3` : deletes the 3rd task shown in the current list +* *`bye`* : exits the app + +. Refer to <> for details of each command. + +[[Features]] +== Features + +==== +*Command Format* + +* Words in `UPPER_CASE` are the parameters to be supplied by the user e.g. in `add TASK_CONTENT`, `TASK_CONTENT` is a parameter which can be used as `add submission`. + +* Items in `square brackets` are optional e.g `d/DESCRIPTION [p/PAYMENT_DETAIL]` can be used as `d/welcome tea p/food 12` or as `d/welcome tea` + +* Items with `…`​ after them can be used multiple times including zero times e.g. `[p/PAYMENT_DETAIL]…`​ can be used as `` ``(i.e. 0 times), `p/food 12`, `p/food 12 p/drinks 7` etc +==== + +=== List out all current deadlines/payment forms: `list` + +List out all current items with their index number+ +Format: `list` + +=== Adding a deadline: `deadline` + +Adds a new deadline + +Format: `deadline d/DESCRIPTION t/TIME` + +[TIP] +there can have spaces in the deadline description + +[TIP] +the format of time should be DD/MM/YYYY HHMM + +Examples: + +* `deadline d/submit venue payment t/05/10/2019 1159` + +=== Adding a new payment: `payments` + +Adds a new payment form with details + +Format: `payments d/DESCRIPTION [p/PAYMENT_DETAIL]...` + +[TIP] +there can have spaces in the description and payment detail +[TIP] +there can be any number of payment details added + +Examples: + +* `payments d/welcome tea p/food 12` +* `payments d/maintenance fee` + +=== Edit the deadline/payment form's description: `edit` + +Edit a previously added task's description and details + +Format: `edit ID d/NEW_DESCRIPTION` + +[TIP] +there can have spaces in the description +[TIP] +the id should not e out of range + +Examples: + +* `edit 2 d/welcome tea for freshmen` + + +=== Edit the deadline time: `reschedule` + +Edit a previously added deadline's time + +Format: `reschedule ID t/NEW_TIME` + +[TIP] +the id input should not be out of range +[TIP] +the format of time should be DD/MM/YYYY HHMM +[TIP] +to postpone the deadline for a short time, use `snooze` could be easier(see 3.7) + +Examples: + +* `reschedule 2 07/10/2019 2359` + +=== snooze the deadline: `snooze` + +snooze the deadline time by 1 hour + +Format: `snooze ID` + +[TIP] +the id input should not be out of range + + +Examples: + +* `snooze 5` + +=== Edit the payment details: `redetail` + +Edit a previously added payment's details + +Format: `redetail ID [d/PAYMENT_DETAIL]...` + +[TIP] +the id input should not be out of range +[TIP] +there can be any number of details + +Examples: + +* `redetail 2 d/drinks 8 d/snacks 20` +* `redetail 2`(i.e. this operation removes all previous details) + +=== Find a payment or deadline based on its description: `find` + +Find a payment or deadline based on its description + +Format: `find d/DESCRIPTION` + +[TIP] +there can have spaces in the description + +Examples: + +* `find d/welcome tea` + +=== View deadline by schedule: `view` +View current deadlines in a specific date + +Format: `view t/DATE` + +[TIP] +the results will be sorted based on their deadlines (i.e. the one with the earliest deadline will show on the top) +[TIP] +the format of the date should be DD/MM/YYYY + +Examples: + +* `view t/05/10/2019` + +=== Delete a deadline/payment form: `delete` + +Delete a deadline/payment from the task list + +Format: `delete ID` + +[TIP] +the index of the task should not be out of range + +Examples: + +* `delete 3` + +=== Approve a payment form: `approve` + +Approve a payment form with a message+ +Format: `approve ID [m/MESSAGE]` + +[TIP] +the index of the task should not be out of range + +Examples: + +* `approve 3 m/approved by xxx on Monday` +* `approve 3` + +=== Mark a deadline as done: `done` + +mark a deadline task as done + +Format: `done ID` + +[TIP] +the index of the task should not be out of range + +Examples: + +* `done 5` + +=== Exit command: `bye` + +exit from Duke + +Format: `bye` + +=== Saving the data + +Task List data are saved in the hard disk automatically after any command that changes the data. + +There is no need to save manually. + + +== Command Summary + +* *list*: `list` +* *deadline*: `deadline d/DESCRIPTION t/TIME` +* *payments* : `payments d/DESCRIPTION [p/PAYMENT_DETAIL]...` +* *edit* : `edit ID d/NEW_DESCRIPTION` +* *reschedule* : `reschedule ID t/NEW_TIME` +* *snooze*: `snooze ID` +* *redetail*: `redetail ID [d/PAYMENT_DETAIL]...` +* *find* : `find d/DESCRIPTION` +* *view* : `view t/DATE` +* *delete* : `delete ID` +* *approve*: `approve ID [m/MESSAGE]` +* *done*: `done ID` +* *exit*: `bye` diff --git a/docs/UserGuide.pdf b/docs/UserGuide.pdf new file mode 100644 index 0000000000..2723d091a8 Binary files /dev/null and b/docs/UserGuide.pdf differ diff --git a/docs/images/karansarant.png b/docs/images/karansarant.png new file mode 100644 index 0000000000..c6cec6096d Binary files /dev/null and b/docs/images/karansarant.png differ diff --git a/docs/images/lijiayu980606.png b/docs/images/lijiayu980606.png index 8a64fa5b16..8d425ca3a0 100644 Binary files a/docs/images/lijiayu980606.png and b/docs/images/lijiayu980606.png differ diff --git a/src/main/java/command/Parser.java b/src/main/java/command/Parser.java index bb1724ea93..9a41cfa6df 100644 --- a/src/main/java/command/Parser.java +++ b/src/main/java/command/Parser.java @@ -90,9 +90,9 @@ else if (isDelete(input)) { }else if (isSnooze(input)) { processSnooze(input, tasklist, ui); storage.save(tasklist.returnArrayList()); - }else if (isPostpone(input)) { - processPostpone(input, tasklist, ui); - storage.save(tasklist.returnArrayList()); +// }else if (isPostpone(input)) { +// processPostpone(input, tasklist, ui); +// storage.save(tasklist.returnArrayList()); }else if (isReschedule(input)) { processReschedule(input, tasklist, ui); storage.save(tasklist.returnArrayList()); @@ -100,6 +100,8 @@ else if (isDelete(input)) { else if (isViewSchedule(input)) { processViewSchedule(input, tasklist, ui); //storage.save(tasklist.returnArrayList()); + }else if(isEdit(input)){ + processEdit(input,tasklist,ui); } else { throw new DukeException(" ☹ OOPS!!! I'm sorry, but I don't know what that means :-("); } @@ -320,6 +322,8 @@ private static void processWithin(String input, TaskList tasklist, Ui ui) { } } + + /** * Process the snooze command and automatically postpone the selected deadline task by 1 hour. * @param input Input from the user. @@ -409,6 +413,20 @@ private static void processReschedule(String input, TaskList tasklist, Ui ui) { } } + private static void processEdit(String input, TaskList tasklist, Ui ui) { + try { + String[] splitspace = input.split(" ", 2); + String[] splitedit = splitspace[1].split(" d/", 2); + int nedit = Integer.parseInt(splitedit[0]) - 1; + String description = splitedit[1]; + tasklist.get(nedit).setDescription(description); + ui.printEditMessage(tasklist.get(nedit)); + }catch(ArrayIndexOutOfBoundsException e){ + ui.exceptionMessage(" ☹ OOPS!!! Please input the correct command format (refer to user guide)"); + }catch(NumberFormatException e){ + ui.exceptionMessage(" ☹ OOPS!!! Please input the correct command format (refer to user guide)"); + } + } private static boolean isBye(String input) { return input.equals("bye"); @@ -453,14 +471,19 @@ private static boolean isSnooze(String input) { return input.startsWith("snooze"); } - private static boolean isPostpone(String input) { - return input.startsWith("postpone"); - } +// private static boolean isPostpone(String input) { +// return input.startsWith("postpone"); +// } private static boolean isReschedule(String input) { return input.startsWith("reschedule"); } + private static boolean isViewSchedule(String input) { return input.startsWith("View Schedule"); } + + private static boolean isEdit(String input) { + return input.startsWith("edit"); + } } diff --git a/src/main/java/task/PaymentDetails.java b/src/main/java/task/PaymentDetails.java new file mode 100644 index 0000000000..63769d5bc6 --- /dev/null +++ b/src/main/java/task/PaymentDetails.java @@ -0,0 +1,19 @@ +package task; + +import java.io.Serializable; + +public class PaymentDetails implements Serializable{ + String item; + double cost; + + /** + * Creates a PaymentDetails instance and initiates the required attributes. + * @param item Item that was bought. + * @param cost Cost of the item in dollars. + */ + public PaymentDetails(String item, double cost){ + this.item = item; + this.cost = cost; + } + +} diff --git a/src/main/java/task/PaymentForm.java b/src/main/java/task/PaymentForm.java new file mode 100644 index 0000000000..79b4ee3406 --- /dev/null +++ b/src/main/java/task/PaymentForm.java @@ -0,0 +1,15 @@ +package task; + +import java.io.Serializable; +import java.util.ArrayList; + +public class PaymentForm extends Task implements Serializable{ + ArrayList paymentslist; + double totalexpense; + + public PaymentForm(String description, ArrayList paymentslist, double totalexpense){ + super(description); + this.paymentslist = paymentslist; + this.totalexpense = totalexpense; + } +} diff --git a/src/main/java/task/Task.java b/src/main/java/task/Task.java index 4688b2b72d..202484f4c7 100644 --- a/src/main/java/task/Task.java +++ b/src/main/java/task/Task.java @@ -12,6 +12,7 @@ public class Task implements Serializable { protected String by; protected String at; protected String after; + protected String period; /** * Creates a Task instance and initialises the required attributes. @@ -59,6 +60,13 @@ public void setAt(String at) { this.at = at; } + /** + * Sets a new value to the description attribute. + */ + public void setDescription(String description) { + this.description = description; + } + /** * Gets the description of the Task. * @return Task Description. diff --git a/src/main/java/ui/Ui.java b/src/main/java/ui/Ui.java index c7df4b2aaf..912faa1ff9 100644 --- a/src/main/java/ui/Ui.java +++ b/src/main/java/ui/Ui.java @@ -135,6 +135,12 @@ public void printRescheduleMessage(Task task) { System.out.print(line); } + public void printEditMessage(Task task) { + System.out.print(line + " Got it. I've edited this task: \n"); + System.out.print(" " + task.giveTask() + "\n"); + System.out.print(line); + } + /** * Prints the message for the exception thrown. * @param message Exception message.