diff --git a/.classpath b/.classpath new file mode 100644 index 000000000000..e1504452f97a --- /dev/null +++ b/.classpath @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore index 823d175eb670..7b3cf845f4d2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,9 @@ lib/* *.log *.log.* *.csv -config.json src/test/data/sandbox/ preferences.json +/config.json .DS_Store ./screenshot*.png classes/ diff --git a/.project b/.project new file mode 100644 index 000000000000..f151561e3e92 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + main + Project main created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/README.adoc b/README.adoc index fa50028b99d0..77afec488b2c 100644 --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,8 @@ -= Address Book (Level 4) -ifdef::env-github,env-browser[:relfileprefix: docs/] += HealthHub -https://travis-ci.org/se-edu/addressbook-level4[image:https://travis-ci.org/se-edu/addressbook-level4.svg?branch=master[Build Status]] -https://ci.appveyor.com/project/damithc/addressbook-level4[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]] -https://coveralls.io/github/se-edu/addressbook-level4?branch=master[image:https://coveralls.io/repos/github/se-edu/addressbook-level4/badge.svg?branch=master[Coverage Status]] -https://www.codacy.com/app/damith/addressbook-level4?utm_source=github.com&utm_medium=referral&utm_content=se-edu/addressbook-level4&utm_campaign=Badge_Grade[image:https://api.codacy.com/project/badge/Grade/fc0b7775cf7f4fdeaf08776f3d8e364a[Codacy Badge]] +https://travis-ci.com/CS2103-AY1819S2-W09-2/main[image:https://travis-ci.com/CS2103-AY1819S2-W09-2/main.svg?branch=master[Build Status]] +https://coveralls.io/github/CS2103-AY1819S2-W09-2/main?branch=master[image:https://coveralls.io/repos/github/CS2103-AY1819S2-W09-2/main/badge.svg?branch=master[Coverage Status]] +image:https://api.codacy.com/project/badge/Grade/59b2e00f57cf432eab91667b827851b9[link="https://app.codacy.com/app/CS2103-AY1819S2-W09-2/main?utm_source=github.com&utm_medium=referral&utm_content=CS2103-AY1819S2-W09-2/main&utm_campaign=Badge_Grade_Dashboard"] ifdef::env-github[] image::docs/images/Ui.png[width="600"] @@ -14,26 +12,46 @@ ifndef::env-github[] image::images/Ui.png[width="600"] endif::[] -* This is a desktop Address Book application. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface). -* It is a Java sample application intended for students learning Software Engineering while using Java as the main programming language. -* It is *written in OOP fashion*. It provides a *reasonably well-written* code example that is *significantly bigger* (around 6 KLoC)than what students usually write in beginner-level SE modules. -* What's different from https://github.com/se-edu/addressbook-level3[level 3]: -** A more sophisticated GUI that includes a list panel and an in-built Browser. -** More test cases, including automated GUI testing. -** Support for _Build Automation_ using Gradle and for _Continuous Integration_ using Travis CI. +== Why HealthHub? + +“Based on trends, if we project into 2050, even with immigration, the population pyramid will be inverted ... +We are going to be growing old faster than any society in the world.” + -Lee Hsien Loong, Prime Minister of Singapore + +With the number of elderly slated to reach 900,000 by 2030, it is no surprise that the resources to meet the healthcare +demands of the nation are being stretched thin. Even today, it is getting harder and harder to have healthcare professionals +come down to our homes to tend to the elderly, on top of their already burgeoning workload in their workplaces. + +Luckily, we now have HealthHub + +HealthHub is the first centralized healthcare platform on the market which allows for healthcare professionals (in the +form of doctors and nurses) and qualified individuals from the community to tend to the needs of elderly at their own +homes. With a dedicated core administrative team, HealthHub intends to match skilled individuals to their respective +jobs efficiently and effectively. + +== Target Group + +HealthHub is looking at 2 large groups of target users. + +* The 1st group comprises qualified individuals with necessary skills, be it basic healthcare skills like administering +IV drip, to higher-level skills like handling dialysis machinery. +* The 2nd group comprises + +** The elderly needing help at home and + +** Guardians of the elderly requiring additional healthcare at home == Site Map -* <> -* <> -* <> -* <> -* <> +* https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/docs/UserGuide.adoc[User Guide] +* https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/docs/DeveloperGuide.adoc[Developer Guide] +* http://github.com/CS2103-AY1819S2-W09-2/main/blob/master/docs/AboutUs.adoc[About Us] +* https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/docs/ContactUs.adoc[Contact Us] == Acknowledgements -* Some parts of this sample application were inspired by the excellent http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by -_Marco Jakob_. +* Original Source Code created by SE-EDU initiative: https://github.com/se-edu/addressbook-level4[addressbook-level4] + * Libraries used: https://github.com/TestFX/TestFX[TextFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/google/guava[Guava], https://github.com/junit-team/junit5[JUnit5] == Licence : link:LICENSE[MIT] diff --git a/_reposense/config.json b/_reposense/config.json new file mode 100644 index 000000000000..9423d3c7811c --- /dev/null +++ b/_reposense/config.json @@ -0,0 +1,30 @@ +{ + "authors": + [ + { + "githubId": "Lookuz", + "displayName": "CHO...YEH", + "authorNames": ["Lookuz"] + }, + { + "githubId": "daviddl9", + "displayName": "D D...TON", + "authorNames": ["daviddl9", "David Livingston"] + }, + { + "githubId": "jing1324", + "displayName": "JIN...ING", + "authorNames": ["jing1324"] + }, + { + "githubId": "brohandev", + "displayName": "ROH...DEV", + "authorNames": ["brohandev", "LAPTOP-QAQAFI16\\Rohan Dev"] + }, + { + "githubId": "huichun66", + "displayName": "TAY...HUN", + "authorNames": ["huichun66"] + } + ] +} diff --git a/build.gradle b/build.gradle index 4f2949b6e774..ea21203dd3e0 100644 --- a/build.gradle +++ b/build.gradle @@ -77,7 +77,7 @@ dependencies { } shadowJar { - archiveName = 'addressbook.jar' + archiveName = 'healthhub.jar' destinationDir = file("${buildDir}/jar/") } @@ -235,3 +235,4 @@ deployOfflineDocs.dependsOn asciidoctor processResources.dependsOn deployOfflineDocs defaultTasks 'clean', 'headless', 'allTests', 'coverage', 'asciidoctor' +apply plugin: 'java' diff --git a/config.json b/config.json new file mode 100644 index 000000000000..a0edc78a820a --- /dev/null +++ b/config.json @@ -0,0 +1,4 @@ +{ + "logLevel" : "INFO", + "userPrefsFilePath" : "preferences.json" +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index a9671a144efd..253292d269ec 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -20,7 +20,6 @@ - diff --git a/config/travis/check-trailing-whitespace.sh b/config/travis/check-trailing-whitespace.sh index 33841caa81f1..513d72026429 100755 --- a/config/travis/check-trailing-whitespace.sh +++ b/config/travis/check-trailing-whitespace.sh @@ -14,11 +14,14 @@ awk ' # (e.g. GitHub web editor) if ($1 ~ /\.md$/) { severity = "WARN" + print severity, $1, $2, " trailing whitespace." + } else if ($1 ~ /\.svg$/) { + # do nth for .svg files under /resources/font-awesome/ folder. } else { severity = "ERROR" ret = 1 + print severity, $1, $2, " trailing whitespace." } - print severity, $1, $2, " trailing whitespace." } END { exit ret diff --git a/data/healthworkerbook.json b/data/healthworkerbook.json new file mode 100644 index 000000000000..29aa3dd028bb --- /dev/null +++ b/data/healthworkerbook.json @@ -0,0 +1,45 @@ +{ + "healthWorkers" : [ { + "name" : "Andy Tan", + "phone" : "94358253", + "nric" : "S8312942G", + "organization" : "NUH", + "skills" : "GENERAL_PRACTICE PHYSIOTHERAPY " + }, { + "name" : "Betty Meier", + "phone" : "98761232", + "nric" : "S8176952L", + "organization" : "CGH", + "skills" : "GENERAL_PRACTICE ORTHOPAEDIC " + }, { + "name" : "Carlie Kurz", + "phone" : "95358463", + "nric" : "S9312942G", + "organization" : "NUH", + "skills" : "GYNAECOLOGY GENERAL_PRACTICE " + }, { + "name" : "Paniel Meier", + "phone" : "87652133", + "nric" : "S9701568T", + "organization" : "SGH", + "skills" : "HAEMATOLOGY PHYSIOTHERAPY " + }, { + "name" : "Ella Meyer", + "phone" : "94824524", + "nric" : "S9112942G", + "organization" : "SGH", + "skills" : "PHYSIOTHERAPY ANAESTHESIOLOGY " + }, { + "name" : "Fione Kunz", + "phone" : "94822373", + "nric" : "S7812942G", + "organization" : "TTSH", + "skills" : "OCCUPATIONAL_THERAPY CARDIOLOGY " + }, { + "name" : "George Best", + "phone" : "94824424", + "nric" : "S8812942G", + "organization" : "TTSH", + "skills" : "UROLOGY PAEDIATRIC " + } ] +} diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index e647ed1e715a..5e2603836928 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -4,53 +4,53 @@ :imagesDir: images :stylesDir: stylesheets -AddressBook - Level 4 was developed by the https://se-edu.github.io/docs/Team.html[se-edu] team. + -_{The dummy content given below serves as a placeholder to be used by future forks of the project.}_ + -{empty} + +HealthHub is developed with love and compassion by the https://github.com/CS2103-AY1819S2-W09-2[W9-02] team. + + We are a team based in the http://www.comp.nus.edu.sg[School of Computing, National University of Singapore]. == Project Team -=== John Doe -image::damithc.jpg[width="150", align="left"] -{empty}[http://www.comp.nus.edu.sg/~damithch[homepage]] [https://github.com/damithc[github]] [<>] +=== Rohan Dev +image::brohandev.png[width="150", align="left"] +{empty}[https://github.com/brohandev[github]] [<>] -Role: Project Advisor +Role: Software Developer + +Responsibilities: Modifying the commands (Add/Edit/Delete/Find) for the Patient class. ''' -=== John Roe -image::lejolly.jpg[width="150", align="left"] -{empty}[http://github.com/lejolly[github]] [<>] +=== Choong Wey Yeh +image::lookuz.png[width="150", align="left"] +{empty}[http://github.com/Lookuz[github]] [<>] -Role: Team Lead + -Responsibilities: UI +Role: Software Developer + +Responsibilities: Modifying the commands (Add/Edit/Delete/Find) for the HealthWorker Class. ''' -=== Johnny Doe -image::yijinl.jpg[width="150", align="left"] -{empty}[http://github.com/yijinl[github]] [<>] +=== David Livingston +image::daviddl9.png[width="150", align="left"] +{empty}[https://github.com/daviddl9[github]] [<>] -Role: Developer + -Responsibilities: Data +Role: Software Developer + +Responsibilities: Modifying the commands (Add/Edit/Delete/Find) for the different type of requests. ''' -=== Johnny Roe -image::m133225.jpg[width="150", align="left"] -{empty}[http://github.com/m133225[github]] [<>] +=== Jin Jing +image::jing1324.png[width="150", align="left"] +{empty}[https://github.com/jing1324[github]] [<>] -Role: Developer + -Responsibilities: Dev Ops + Threading +Role: Software Developer + +Responsibilities: Managing the storage related classes and its associated dependencies. ''' -=== Benson Meier -image::yl_coder.jpg[width="150", align="left"] -{empty}[http://github.com/yl-coder[github]] [<>] +=== Tay Hui Chun +image::huichun66.png[width="150", align="left"] +{empty}[http://github.com/huichun66[github]] [<>] -Role: Developer + -Responsibilities: UI +Role: User Interface Developer + +Responsibilities: Responsible for the UI of the main app and its different interactions. ''' diff --git a/docs/ContactUs.adoc b/docs/ContactUs.adoc index 5de5363abffd..3f918d42432c 100644 --- a/docs/ContactUs.adoc +++ b/docs/ContactUs.adoc @@ -2,6 +2,7 @@ :site-section: ContactUs :stylesDir: stylesheets -* *Bug reports, Suggestions* : Post in our https://github.com/se-edu/addressbook-level4/issues[issue tracker] if you noticed bugs or have suggestions on how to improve. -* *Contributing* : We welcome pull requests. Follow the process described https://github.com/oss-generic/process[here] -* *Email us* : You can also reach us at `damith [at] comp.nus.edu.sg` +* *Bug Reports, Suggestions* : Post in our http://github.com/CS2103-AY1819S2-W09-2/main/issues[issue tracker] if you noticed any bugs or +have suggestions on how the app can be improved. +* *Contributing* : We welcome pull requests. Follow the process described https://github.com/oss-generic/process[here]. + diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc index 8b92d5fb7e62..d65aa9a15bc6 100644 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -1,9 +1,10 @@ -= AddressBook Level 4 - Developer Guide += Health Hub - Developer Guide :site-section: DeveloperGuide :toc: :toc-title: :toc-placement: preamble :sectnums: +:icons: font :imagesDir: images :stylesDir: stylesheets :xrefstyle: full @@ -13,26 +14,42 @@ ifdef::env-github[] :warning-caption: :warning: :experimental: endif::[] -:repoURL: https://github.com/se-edu/addressbook-level4/tree/master +:repoURL: https://github.com/CS2103-AY1819S2-W09-2/main/tree/master -By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT` +By: `Team W9-02 (HealthHub)`      Since: `Jan 2019`      Licence: `MIT` == Setting up === Prerequisites -. *JDK `9`* or later +. *JDK `9`* +* The Java Development Kit, or JDK for short, provides the necessary existing + libraries and implementations that we have used in our implementation of + HealthHub. The current version of HealthHub needs at least JDK version 9 to + support the full functionality it has to offer. + [WARNING] JDK `10` on Windows will fail to run tests in <> due to a https://github.com/javafxports/openjdk-jfx/issues/66[JavaFX bug]. Windows developers are highly recommended to use JDK `9`. . *IntelliJ* IDE +* IntelliJ is an Integrated Development Environment(IDE) that provides the +necessary tools and available plugins needed to compile, build and run the +project. + [NOTE] IntelliJ by default has Gradle and JavaFx plugins installed. + Do not disable them. If you have disabled them, go to `File` > `Settings` > `Plugins` to re-enable them. +[NOTE] +==== +Don't have Intellij or JDK installed? Click on the following links to +download them below: + +* IntelliJ: https://www.jetbrains.com/idea/ + +* Java Development Kit: https://www.oracle.com/technetwork/java/javase/downloads/index.html +==== === Setting up the project in your computer @@ -45,7 +62,7 @@ Do not disable them. If you have disabled them, go to `File` > `Settings` > `Plu . Locate the `build.gradle` file and select it. Click `OK` . Click `Open as Project` . Click `OK` to accept the default settings -. Open a console and run the command `gradlew processResources` (Mac/Linux: `./gradlew processResources`). It should finish with the `BUILD SUCCESSFUL` message. + +. Open a console and run the command `gradlew processResources`. For Mac/Linux environments, run the command `./gradlew processResources` instead. It should finish with the [green]`BUILD SUCCESSFUL` message. + This will generate all resources required by the application and tests. . Open link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow.java`] and check for any code errors .. Due to an ongoing https://youtrack.jetbrains.com/issue/IDEA-189060[issue] with some of the newer versions of IntelliJ, code errors may be detected even if the project can be built and run successfully @@ -72,36 +89,23 @@ This project follows https://github.com/oss-generic/process/blob/master/docs/Cod Optionally, you can follow the <> document to configure Intellij to check style-compliance as you write code. -==== Updating documentation to match your fork - -After forking the repo, the documentation will still have the SE-EDU branding and refer to the `se-edu/addressbook-level4` repo. +==== Getting started -If you plan to develop this fork as a separate product (i.e. instead of contributing to `se-edu/addressbook-level4`), you should do the following: +When you have set up your environment successfully for building and running +HealthHub, you are ready to get started on coding to contribute to the +project. But before that, you may consider familiarising yourself with +HealthHub through the following: -. Configure the <> in link:{repoURL}/build.gradle[`build.gradle`], such as the `site-name`, to suit your own project. +* Familiarising yourself with the model, logic and storage design of +HealthHub under the section <>. -. Replace the URL in the attribute `repoURL` in link:{repoURL}/docs/DeveloperGuide.adoc[`DeveloperGuide.adoc`] and link:{repoURL}/docs/UserGuide.adoc[`UserGuide.adoc`] with the URL of your fork. +* Get a good feel of how existing features are implemented under the +<> section. -==== Setting up CI +* Follow the way that the testing suite for features are built in +<> -Set up Travis to perform Continuous Integration (CI) for your fork. See <> to learn how to set it up. - -After setting up Travis, you can optionally set up coverage reporting for your team fork (see <>). - -[NOTE] -Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your personal fork. - -Optionally, you can set up AppVeyor as a second CI (see <>). - -[NOTE] -Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based) - -==== Getting started with coding - -When you are ready to start coding, - -1. Get some sense of the overall design by reading <>. -2. Take a look at <>. +* Painlessly automate build integration by following the steps under <> == Design @@ -138,79 +142,81 @@ Each of the four components * Defines its _API_ in an `interface` with the same name as the Component. * Exposes its functionality using a `{Component Name}Manager` class. -For example, the `Logic` component (see the class diagram given below) defines it's API in the `Logic.java` interface and exposes its functionality using the `LogicManager.java` class. - -.Class Diagram of the Logic Component -image::LogicClassDiagram.png[width="800"] [discrete] ==== How the architecture components interact with each other The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1`. -.Component interactions for `delete 1` command -image::SDforDeletePerson.png[width="800"] +.Component interactions for `delete request 1` command +image::logicseqdiagram.png[width="800"] The sections below give more details of each component. +// tag::ui-header[] [[Design-Ui]] === UI component .Structure of the UI Component image::UiClassDiagram.png[width="800"] -*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`] +*API* : link:{repoURL}/src/main/java/seedu/address/ui[UI Package] + +The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `RequestListPanel`, `InfoPanel`, `HealthWorkerListPanel`, `StatusBarFooter`, etc. -The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter`, `BrowserPanel` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class. +All of these, including the `MainWindow`, inherit from the `UiPart` class, which is an abstract class containing methods for handling the loading of `FXML` files. -The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`] +The `UI` component uses the JavaFX UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`] The `UI` component, * Executes user commands using the `Logic` component. -* Listens for changes to `Model` data so that the UI can be updated with the modified data. +* Listens for changes to the `Model` data so that the UI can be updated with the modified data dynamically. +// end::ui-header[] +// tag::logic-header[] [[Design-Logic]] === Logic component [[fig-LogicClassDiagram]] .Structure of the Logic Component -image::LogicClassDiagram.png[width="800"] +image::logicclassdiag.png[width="800"] *API* : link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`] -. `Logic` uses the `AddressBookParser` class to parse the user command. +. `Logic` uses the `HealthHubParser` class to parse the user command. . This results in a `Command` object which is executed by the `LogicManager`. -. The command execution can affect the `Model` (e.g. adding a person). +. The command execution can affect the `Model` (e.g. adding a request) or sometimes only affecting the display (eg. listing all requests). . The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`. -. In addition, the `CommandResult` object can also instruct the `Ui` to perform certain actions, such as displaying help to the user. - -Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("delete 1")` API call. +. In addition, the `CommandResult` object can also instruct the `Ui` to perform certain actions, such as printing out the result message in the command line. -.Interactions Inside the Logic Component for the `delete 1` Command -image::DeletePersonSdForLogic.png[width="800"] +// end::logic-header[] [[Design-Model]] === Model component .Structure of the Model Component -image::ModelClassDiagram.png[width="800"] +image::modelUmlDiagram.png[width="800"] *API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`] The `Model`, -* stores a `UserPref` object that represents the user's preferences. -* stores the Address Book data. -* exposes an unmodifiable `ObservableList` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. -* does not depend on any of the other three components. +* stores the `Request` Book data. +* stores the `HealthWorker` Book data. +* Both `HealthWorkerBook` and `RequestBook` stores multiple previous states +in the form of `ReadOnlyHealthWorkerBook` and `ReadOnlyRequestBook`. +* A `UserPrefs` object denoting the user settings for the application. [NOTE] -As a more OOP model, we can store a `Tag` list in `Address Book`, which `Person` can reference. This would allow `Address Book` to only require one `Tag` object per unique `Tag`, instead of each `Person` needing their own `Tag` object. An example of how such a model may look like is given below. + - + -image:ModelClassBetterOopDiagram.png[width="800"] +As a more OOP model, we store a list of `Request` objects in `Request Book`, which stores the details of every request, including the patient's details, request date and status. +In addition, each `Request` also stores a `Set` of `Conditions` of the patient. + +Similarly for `HealthWorker`, the list of `HealthWorker` is stored in a +`HealthWorkerBook`, and each `Specialisation` that the `HealthWorker` has is +stored in a `Set` that is contained in the `Skills` class. +// tag::storage[] [[Design-Storage]] === Storage component @@ -222,7 +228,13 @@ image::StorageClassDiagram.png[width="800"] The `Storage` component, * can save `UserPref` objects in json format and read it back. -* can save the Address Book data in json format and read it back. +* can save the Request, HealthWorker Book data in json format and read it back. + +[NOTE] +The storage class converts the object data of `Request` and `HealthWorker` by converting the objects +into a json object of strings which will be stored in the `.json` file. When reading the file, the json library passes the respective strings into +their java object constructors to recreate the objects. +// end::storage[] [[Design-Commons]] === Common classes @@ -233,95 +245,954 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa This section describes some noteworthy details on how certain features are implemented. +The `add`, `edit` and `delete` command have been tweaked to include addition of and `Request` and `HealthWorker`. + +`CommandMode` Enum class was introduced in v1.1 to allow for `add`, `edit` +and `delete` different types of objects respective to the different +`CommandMode` Enums. The various `CommandMode` enums are: +** `CommandMode.HEALTHWORKER` +** `CommandMode.REQUEST` +** `CommandMode.OTHERS` +** `CommandMode.INVALID` + +Each `CommandMode` enum is matched by it's own corresponding set of keywords, + which are string equivalents of the enum counterparts that the user can + input to specify the type of object he/she wishes to add. For example: + +* The command string `add healthworker n/Dog Terr` that is entered by the +user contains the keyword `healthworker` after the `add` command word, which +is mapped to it's `CommandMode` equivalent in `AddCommandParser`. + +The `CommandMode` enum also has a `Set healthWorkerModes = new HashSet<>(Arrays.asList("healthworker", "h", "1")); + private static final Set requestModes = new HashSet<>(Arrays.asList("request", "r", "2")); + + /** + * Method that checks for the corresponding CommandMode given a string input. + * Returns INVALID if input string does not match any of the given modes. + */ + public static CommandMode checkMode(String input) { + if (healthWorkerModes.contains(input)) { + return CommandMode.HEALTH_WORKER; + } else if (requestModes.contains(input)) { + return CommandMode.REQUEST; + } + + return CommandMode.INVALID; + } +} +``` + +These `CommandModes` provide flexbility and functionality to switch between + parsing of different `HealthWorker` and `Request` objects. + +* Each of the `add`, `edit` and `delete` command is eventually parsed through + the `AddCommandParser`, `EditCommandParser` and `DeleteCommandParser` + classes respectively, which returns an `AddCommand`, `EditCommand` and + `DeleteCommand` object respectively. + +=== Add feature + +The `add` command allows for users to register new `HealthWorker` and +`Request` objects into HealthHub. + +The format for the `add` command is as follows: + +`add ...` + + +When the user inputs an `add` command, the `add` command is eventually passed + into an `AddCommandParser` object that handles the argument fields after the + `add` keyword in the command. + +The `AddCommandParser` first checks the first keyword in the string for a valid +`CommandMode` string equivalent. if the keyword does not contains a valid +string representation of any `CommandMode` enum, then a `ParseException` is +thrown by the `AddCommandParser`. This initial sequence of steps is also +repeated in the following `EditCommandParser` and `DeleteCommandParser` objects. + +After checking for valid keyword, the `AddCommandParser` object checks for +the following compulsory information, along with regular expressions checking + for validity of each field: + +==== Adding a `HealthWorker` + +Format: `add healthworker/h/1 ...` + + +* `name` field prepended by the `n/` prefix. Valid inputs of `name` field +will be represented and stored as a `Name` class object. +** `name` field can only contain alphanumeric characters, and cannot be an +empty string. +* `phone` field prepended by the `p/` prefix. Valid inputs of `phone` field +will be represented and stored as a `phone` class object. +** `phone` contains only 8 numeric digits, of which the first must start with + a 6,8 or 9. +* `nric` field prepended by the `i/` prefix. Valid inputs of `nric` field will +be represented and stored as a `Nric` class object. +** `nric` field must contains a 9 character string, starting with either a S +or T, followed by 7 numeric digits and a alphabet letter. All letters used +must be capitalized +* `organization` field prepended by the `o/` prefix. Valid inputs of +`organization` field will be represented and stored as a `Organization` class +object. +** The `organization` field must contain only alpha numeric characters, and +contain at least 2 characters. +* `specialisation` field prepended by the `s/` prefix. All valid +`specialisation` fields will be parsed into it's respective `Specialisation` +enum equivalent, collected and stored as a `Set` in the +`Skills` class object. +** The values in the `specialisation` field will be only be accepted if +they correspond to specific mappings to an existing `Specialisation` enum that +are registered in HealthHub. For information on the valid Specialisation +mappings, visit + +`AddCommandParser` first checks for the presence of the prefixes for each of +the compulsory fields mentioned above. If any of them are missing, or if any +invalid fields as per the conditions mentioned above, then the +command is invalid and a `ParseException` is thrown. + +If the keyword denoted maps to `CommandMode.HEALTHWORKER`, then +`AddCommandParser` constructs a `HealthWorker` object representing the health worker that is +just added with the respective `Name`, `Phone`, `Nric`, `Organization` and +`Skills` objects parsed from the user input, and returns an `AddCommand` +contain the constructed person to be added. + +[NOTE] +==== +If multiple fields of the same prefix are added, the last value of the last +field will be the one accepted for all fields except the `specialisation` field. +==== + +Upon a successful `add` command, the new `HealthWorker` or `Request` +constructed from the user entered fields will be added to the end of the `UniqueHealthWorkerList`. + +===== Valid Specialisations + +The `Specialisation` field is an `Enum` type in Java, and supports only the +enum fields that are specified in the `Specialisation` class itself. + +The various available specialisation enum values of the `Specialisation` +class is as follows in the implementation of `Specialisation`: + +``` +public enum Specialisation { + + GENERAL_PRACTICE, + CARDIOLOGY, + ENDOCRINOLOGY, + NEUROLOGY, + ORTHOPAEDIC, + PAEDIATRIC, + GYNAECOLOGY, + UROLOGY, + PATHOLOGY, + HAEMATOLOGY, + PHYSIOTHERAPY, + OCCUPATIONAL_THERAPY, + ANAESTHESIOLOGY; + + ... +} + +``` + +=== Add Request feature + +==== Current Implementation +The `add request` command allows the `LogicManager` to create a new request and add it to the list of requests. Adding a new request requires the +patient's name, patient's phone number, patient's address, patient's NRIC number and the patient's conditions. The format of the add request command is +add request n/NAME p/PHONE i/NRIC a/ADDRESS dt/DATETIME c/CONDITION. + +The following sequence shows the sequence when the add command is execute by the LogicManager: + +image::addrequest.png[width=800] +Figure 3.2.1.1 Sequence Diagram for `add request` command + +From the diagram above: + +. `LogicManager`'s execute is called when the administrator keys in `add request` and it calls upon `parseCommand` of `HealthHubParser` to parse the command +. `HealthHubParser` will initialize `AddCommandParser` and invoke the method `parse` to further parse `request` command +. `parse` will be invoked and passed the parameters of the add command. +. If all the arguments of the `add` commands are valid, `AddRequestCommand` will be returned to the `LogicManager` +. `LogicManger` will then calls the method `execute` method of `AddRequestCommand` +. `AddRequestCommand` will call `addRequest` passing `Request` as an argument to `Model` and after calls `commitRequestBook` method from `Model` +. A `CommandResult` will be returned at the end. + +==== Design Consideration +===== Aspect: Data Structure for the list of Requests +* **Alternative 1 (Current Approach):** Using a `UniqueRequestList` +** Pros: The comparison is not as rigid. You can create requests with similar names/phones as long as it passes a less stringent criteria. +** Cons: You need additional overhead. You need to create an extra class and function to check. + +* **Alternative 2:** Using a `Set` +** Pros: Do not need an extra function. You can use use `equals` for comparison +** Cons: It is a strict check and as a result you will not be allowed to create requests with same phone/same name etc. + +===== Aspect: Data Structure of `Request` +* **Alternative 1 (Current Approach):** All parameters in `Request` are abstracted out to have a class of its own (with the exception of the HealthWorker). +** Pros: It adheres to the Single Responsibility Principles (SRP) and the Separation of Concerns (SoC) as each parameter checks whether it is valid +** Cons: Many different classes are created which increases the complexity of the code + +* **Alternative 2:** Store all parameters of `Request` as `String` +** Pros: Easy to implement. +** Cons: Violates SRP as one single class will need to check if the arguments are valid. + +[NOTE] +The `RequestStatus` class within the `Request` object utilises the Java `Enum` to ensure type safety in user inputs. + +The implementation of the `RequestStatus` class is as follows: + +``` + private enum Status { + PENDING, + ONGOING, + COMPLETED + } + + public RequestStatus(String status) { + this.requestState = Status.valueOf(status); + } + + public RequestStatus() { + this(Status.PENDING.name()); + } +``` + +Through this, any user String that is passed in as an argument for the `RequestStatus` field is automatically type checked, +ensuring that there are no invalid request statuses entered. + + +=== Edit feature + +The `edit` command allows users to modify details of existing `HealthWorker` +or `Request` objects should the information need to be updated. + +The format for the `edit` command is as follows: + +`edit []...` + + +Similar to the `add` command, the `edit` command arguments are first checked +passed into the `EditCommandParser` class instance, where it evaluates for a +valid first keyword and argument prefixes and values. Additionally, the +`` field is also checked against the existing list of `HealthWorker` +or `Request` to ensure that the provided `` is a valid `` in +the list. + +The argument field after the first keyword denoting the specified +`CommandMode` must not be empty, and must contain at least one valid prefix +and a valid value for the respective field to be edited. The prefixes and +validity follows the same conditions as stated in the `add` command. + +[NOTE] +===== +Similar to the `add` command, only the last value will be accepted for fields + with the same prefixes. + +If any `specialisation` fields are entered, the current `Skills` object of +the `HealthWorker` object being edited will be entirely replaced by a new +`Set` of `Specialisation` that corresponds to valid `specialisation` fields +enteed by the user. +===== + +==== Editing `HealthWorker` + +Upon parsing the argument string into `EditCommandParser`, it first checks +that the `` field provided is non-negative, and not greater than the +size of the `UniqueHealthWorkerList`. + +After checking for a valid `CommandMode.HEALTHWORKER` keyword after the +`edit` command word, `EditCommandParser` then tokenizes the argument string +after the keyword into a `ArgumentMultiMap` object that stores the prefix to +values mapping for each field specified. If no prefixes, or invalid prefixes +are specified, or if invalid values for any prefix is input, then +`EditCommandParser` throws a `ParseException`, and displays an error message +to the terminal. + +If all values specified are valid and at least one field to specify is +provided, the `EditCommandParser` parses the `ArgumentMultiMap` containing +the values to be updated and it's respective prefixes into an +`EditHealthWorkerDescriptor` object. `EditCommandParser` then passes the +`EditHealthWorkerDescriptor` and the `HealthWorker` object fetched from the +`HealthWorkerBook` using the specified valid `` into a +`EditHealthWorkerCommand` object and returned. + +In the `EditHealthWorkerCommand`, each `HealthWorker` related field prefix is +checked for it's value in `EditHealthWorkerDescriptor`, and if a value +exists, it replaces the current value of the corresponding field in the +`HealthWorker` object. Else, the field in `HealthWorker` is unchanged. + +Upon a successful `edit` command, the `HealthWorker` or `Request` object that + has had it's fields edited will immediately reflect the changes in details on + the GUI. + +=== Delete feature + +Using the `delete` command, the user can remove `HealthWorker` and `Request` +objects from the system. + +The format for the `delete` command is as follows: + +`delete ` + + +The `delete` command takes in only two arguments after the `delete` command +word: the `` corresponding to the respective `CommandMode` enum, as +well as the `` of the `HealthWorker` or `Request` object to be +deleted, as indicated in the `UniqueHealthWorkerList` or `UniqueRequestList` +displayed in the GUI. + +The `` entered by the user is one-based, while it is converted to it's + zero-based format in HealthHub during the deletion process. This ensures + that non-technical people who use HealthHub do not need to adjust to + zero-based indexing, and can continue using one-based indexing which they + are more familiar with. + +If the user enters an invalid `` field, such as a negative index or an + index that is greater than the size of the `UniqueHealthWorkerList` or + `UniqueRequestList`, then a `ParseException` will be thrown, and an error + message will be displayed to the user. + +Upon successful `delete` of a valid `HealthWorker` or `Request`, the removed +entity will be immediately reflected on the GUI, and be removed from view. + + +// tag::assignrequest[] +=== Assign Request feature + +The assign request feature allows an administrator to assign a request to a particular healthworker. + +==== Current Implementation + +The following sequence diagram shows the sequence flow from the `LogicManager` to the `ModelManager` when a user enters a `assign request` command: + +image::assignreq.png[] +Figure 3.3.1.1 Sequence diagram to illustrate `Logic` component interactions for `assign request` command. + +image::assignReqToHw.png[] +Figure 3.3.1.2 Sequence diagram to illustrate `Logic` and `Model` component interactions for [blue]`AssignRequestCommand`. + +image::addHwRequestDates.png[] +Figure 3.3.1.3 Sequence diagram illustrates addition of the relevant `Date` objects into the `TreeSet` of the `healthWorker`. + +image::checkConflictingRequests.png[] +Figure 3.3.1.4 Sequence diagram illustrates interaction between `AssignRequestCommand` and `healthWorkerAppointments` + +1. When `LogicManager` receives the `execute` command, it calls the `parseCommand` method in `RequestBookParser`. +2. `RequestBookParser` will receive `assign` as the command and instantiate `AssignRequestCommandParser` to further parse the command. +3. If the arguments specified in the `assign` command are invalid, a `AssignCommand` will be created and returned back to the `LogicManager`. +4. `LogicManager` will proceed to call the `execute` command of `AssignCommand` +5. `AssignRequestCommand` will proceed to call the `getFilteredRequestList` method of `Model`. +6. Iterate through the `requestIds`, if valid, add the `request` corresponding to that `index` to the set of `Request`. +7. Iterates through all the requests already assigned to that `healthWorker`. If there is a conflict of schedule (i.e Requests assigned +to that healthWorker are less than 2 hours apart), a `CommandException` is thrown. +8. Writes the updated request to the `RequestBook` in `ModelManager`, if all the request timings are valid. + +==== Design Consideration + +===== Aspect: Algorithm in ensuring no clashing requests assigned to healthworkers - Data Structure and implementation +* Alternative 1 (current choice): Using a Balanced Binary Search Tree (java `TreeSet`) to keep track of the [blue]`RequestDate` of each request attended to by a particular `healthWorker`. +** Reasoning: Since the allowed time interval between 2 consecutive requests should be at least 2 hours, we can take advantage +of of this by only keeping track of the start time of requests. Hence we can utilise the `ceiling()`, `contains()` and `floor()` methods of the `TreeSet`, which runs effeciently in O(log N) time (where N is the number of requests). Here is the code snippet that implements this: +``` + // Note: healthWorkerAppointments is the TreeSet that stores the appointment dates + Date date = request.getRequestDate().getDate(); + calendar.setTime(date); + calendar.add(Calendar.HOUR_OF_DAY, -MIN_REQUEST_DURATION); // MIN_REQUEST_DURATION = 2 hours + Date lowerLimit = calendar.getTime(); + calendar.add(Calendar.HOUR_OF_DAY, 2 * MIN_REQUEST_DURATION); + Date upperLimit = calendar.getTime(); + + if (healthWorkerAppointments.contains(date) || (healthWorkerAppointments.lower(date) != null + && healthWorkerAppointments.lower(date).after(lowerLimit)) + || (healthWorkerAppointments.higher(date) != null + && healthWorkerAppointments.ceiling(date).before(upperLimit))) { + throw new CommandException(Messages.MESSAGE_HEALTHWORKER_OCCUPIED_CANNOT_ASSIGN); + } + + healthWorkerAppointments.add(date); +``` + +image::assignRegionCheck.png[] +Figure 3.3.1.5 Shows visualisation of time ranges that are valid. + +The above mentioned code snippet checks that there are not clashing requests that fall within the red region, as depicted in Figure 3.3.1.5. + +* Alternative 2: For each request to be assigned, manually iterate through the Request list to ensure that there are not clashing dates. +Pros: Easy to implement +Cons: Slow - in the worst case, if all the requests get assigned at once, this operation will run in O(n^2) time. + +===== Aspect: Relationship between [blue]`Request` and [blue]`Healthworker` +* Alternative 1 (current choice): The [blue]`Request` holds a unique identifier of the [blue]`HealthWorker` (i.e the `NRIC`) assigned to it. +** Pros: Simplification of implementation. +** Pros: Cleaner implementation, low level of dependencies on other modules. This also makes it easier to test, and easier to maintain. +** Cons: Makes it difficult to obtain all details of the `healthWorker` assigned from a [blue]`Request` object. The healthworker with the unique NRIC will have the be queried from the `healthWorkerList` + +* Alternative 2: The `Request` holds a `HealthWorker` object and the `HealthWorker` keeps track of a list of `Request`s. +** Pros: Can quickly access details of a `HealthWorker` from a `Request`, and can quickly access the `Requests` assigned to a `HealthWorker` from the `Request`. +** Cons: Increases complexity of code base, adding additional dependencies to the code. This makes the code base more verbose and more difficult to maintain. + +// end::assignrequest[] +=== List Feature +The `list` command allows the user to be able to display all `HealthWorker` +or `Request` objects stored in the current application. + +==== Listing `HealthWorker` objects +* Format: `list healthworker/h/1` +* Displays all `HealthWorker` objects already stored in the current +application, and the following details: +** `name` - Name of the `HealthWorker` +** `nric` - NRIC of the `HealthWorker` +** `organization` - Organization of the `HealthWorker` +** `skills` - Skills and Specialisations that the `HealthWorker` object +possesses + +==== Listing `Request` objects +* Format: `list request/r/2` +* Displays all `Request` objects already stored in the current +application, and the following details: +** `name` - Name of the patient that made the request in `Request` object. +** `address` - Address of the patient +** `condition` - Condition of the patient that made the request. + +=== Filter Feature + +With the filter command, users can provide specific parameters that act as +conditions for HealthHub to filter the `UniqueHealthWorkerList` and +`UniqueRequestList` by. Using these parameters, HealthHub displays only the +`HealthWorker` or `Request` whose fields contains the specified parameters. + +Command Format: `filter / [/] +...` + +[NOTE] +==== +The `` and `` specified in the command descriptions +below follow the same valid prefix and parameter formats as the `add`, `edit` + and `delete` commands +==== + +==== Filtering `HealthWorker` + +The command format for filtering `HealthWorker` is: + +`filter healthworker/h/1 / [/]...` + +The fields in `HealthWorker` that the user can filter by are: + +* `name` prepended by `n/` prefix +* `organisation` prepended by the `o/` prefix +* `specialisation` prepend by the `s/` prefix + +[NOTE] +==== +If multiple `specialisation` fields are provided, HealthHub will filter the +`UniqueHealthWorkerList` by displaying `HealthWorker` that contains both +specified `specialisations +==== + +HealthHub filters the respective list of `HealthWorker` and `Request` by +checking if the corresponding field contains the specified parameter as a +substring. + +For example entering the command `filter h n/John` displays a list of +`HealthWorker` whose name equals to John, or contains John as a substring(E.g + Johnny, Johnson). + +// tag::filterHealthWorker[] +==== Filtering `HealthWorker` + +The `filter` command allows users to display only `HealthWorker` or `Request` + whose fields matches the `` specified in the filter command. + +Format: `filter healthworker/h/1 / [] +...` + +* The `filter` command checks for `HealthWorker` whose field specific to the +`` contains or matches the `` provided. +* Example: `filter h n/John` changes the UI to display only `HealthWorker` +whose name is John, or contains John (Johnny, Johnson, ...) + +Upon entering the `filter` command, the `filter` command word is stripped from the + input and the argument fields are passed into the `FilterCommandParser` class. +The regular expressions for checking the fields for `name`, `organisation` +and `skills` follows the same format as mentioned in `add` command. If +invalid parameters are specified by the user, or if an invalid `keyword` was +specified that does not correspond to any `CommandMode` enum, then +`FilterCommandParser` throws a `ParseException` and displays an error message + to the user. + +If valid inputs are provided, `FilterCommandParser` tokenizes the argument +string without the `keyword` using `ArgumentTokenizer` object, mapping each +parameter to it's respective prefix in an `ArgumentMultiMap` object. +`FilterCommandParser` then creates a `Predicate` object using the parameter +values in `ArgumentMultiMap` for each filter condition, and composes them +into a single `Predicate` using the `and` function in `Predicate` in +conjuction with `stream` and `reduce` methods from Java's `Function` library. + The `Predicate` object composed is then passed into + `FilterHealthWorkerCommand`, which sets the predicate for the `HealthWorker` + list in the GUI to display only `HealthWorker` whose fields matches the + `Predicate` set. + +===== Design Considerations + +During the implementation of the `filter` command, we decide between two +alternative implementations of managing the `Predicates` created from +multiple criteria input by the user. + +The following table states the considerations for performance as well as +future implementations and enhancements to HealthHub that were taken into +account: + +// tag::filterHealthWorkerTable[] +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +| Design +| Using a `List` of `Predicate` +| Composed `Predicate` using `and` method + +| How it works +| Each user input condition will be parsed into `Predicate`, +which are stored in an `List`. +*Pros*: Easier to manage each single `Predicate` as they are kept separate +*Cons*: Need to rework existing GUI implementation for `filter` as it only +uses a single `Predicate` Object +| Each user input will be parsed into a `Predicate` object, and all the +`Predicate` formed will be composed into a single `Predicate` object. +*Pros*: Ease of existing and future implementations as functionality only +depends on `Predicate` +*Cons*: Unable to specify actions for each `Predicate` + +| Implementation +| User inputs are first parsed into `Predicate` equivalents, +and then added to an `ArrayList`. `FilterCommandParser` then takes the +existing `UniqueHealthWorkerList`, checks for `HealthWorker` whose fields +matches the list of `Predicate` using `allMatch` method from the `Predicate` +library, and then returns an `ObservableList` containing those `HealthWorker`. +| User inputs are parsed into `Predicate` equivalents, which are then composed +into a single `Predicate` containing the logic of all the composed +`Predicates` using the `and` method from `Predicate` library. The composed +`Predicate` is then set as the filter condition into the existing +`ObservableList` of `HealthWorker` in the UI component. + +|======================================================================= +// end::filterHealthWorkerTable[] + +Ultimately, the decision was made to implement the `filter` command by +composing the `Predicate` that were formed from the user inputs into a single + `Predicate` using a combination of Java's `Function` library methods + `stream` and `reduce`, as well as the `and` method used in Java's + `Predicate` library. + +This is because maintain a `List` of `Predicate` in HealthHub requires an +unnecessary rework of many existing components in HealthHub in order to fit +the new implementation of using a `List`, such as replacing `Predicate` in +methods involved with `List`. + +In addition, by returning a single `Predicate` object, ease of implementation + of methods in `filter` command, as well as any future or existing + enhancements to `filter` reduces the complexity of code as the function + needs only to depend on `Predicate` and not `List`, hence observing the Law + of Demeter. + +===== Current Implementation + +The following sequence diagram shows the flow of events when the `filter h +s/physio` command is entered by the user to display only `HealthWorker` +objects that possess expertise in physiotherapy: + +image::FilterHealthWorkerSD.png[width=800] +Figure 3.6.1.1: Sequence diagram illustrating the interactions between the +`Logic` and `Model` components when `filter` command is called. + +. When the user inputs the full command `filter h s/physio`, the +`LogicManager` object takes in the command string, and passes it into +`HealthHubParser` using the `parseCommand` method. +. `HealthHubParser` identifies the command word in the input string, which is + `filter`, and identifies the appropriate `CommandParser` object to parse the + user command. +. `HealthHubParser` strips the `filter` command word off the user input, and +passes the remaining argument string in to a new `FilterCommandParser` object + as corresponding to the `filter` command word. +. `FilterCommandParser` then checks for a valid `CommandMode` that +corresponds to the first keyword in the argument string. In this case, the +keyword `h` corresponds to the `CommandMode.HEALTHWORKER` value. +`FilterCommandParser` then creates a `FilterHealthWorkerCommand` with the +`Predicate` constructed from the fields remaining in the argument string. For + full detail on the implementation of the `FilterCommandParser` logic, see + the sequence diagram in figure 3.6.1.2 below. +. `FilterCommandParser` returns the `FilterHealthWorkerCommand` object to +`HealthHubParser`, which calls the `execute` method of +`FilterHealthWorkerCommand`. +. `FilterHealthWorkerCommand` uses Java 8's `Predicate` and `Function` +libraries to condense all the supplied `List` into a single +`Predicate` using the `and`, `reduce` and `stream` method calls. After which, + it calls the `updateFilteredHealthWorker` method in `Model` to set the + condensed `Predicate` on the `UniqueHealthWorkerBook` in `Model`, displaying + only the `HealthWorker` that evaluates the set `Predicate` to true on the GUI. + + +image::FilterCommandParserLogicSD.png[width=800] +Figure 3.6.1.2 Sequence Diagram that details the interaction that happens +within the `FilterCommandParser` class when it's `parse()` method is called. + +// end::filterHealthWorker[] + // tag::undoredo[] === Undo/Redo feature + ==== Current Implementation -The undo/redo mechanism is facilitated by `VersionedAddressBook`. -It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`. +The undo/redo mechanism is facilitated by `VersionedBook`. +There are two extensions of it. `VersionedHealthWorkerBook` extends `HealthWorkerBook` and `VersionedRequestBook` extends `RequestBook`. +Both contain an undo/redo history, stored internally as an `healthWorkerBookStateList` or `requestBookStateList` + and `currentStatePointer`. Additionally, it implements the following operations: -* `VersionedAddressBook#commit()` -- Saves the current address book state in its history. -* `VersionedAddressBook#undo()` -- Restores the previous address book state from its history. -* `VersionedAddressBook#redo()` -- Restores a previously undone address book state from its history. +* `VersionedBook#commit()` -- Saves the current request/healthworker book state in its history. +* `VersionedBook#undo()` -- Restores the previous request/healthworker book state from its history. +* `VersionedBook#redo()` -- Restores a previously undone request/healthworker book state from its history. + +These operations are exposed in the `Model` interface as `Model#commit()`, `Model#undo()` +and `Model#redo()` respectively. + + +The feature also makes use `ModifyCommandHistory` to keep track of the commands that modified the books. It contains +`currentStatePointer` and a list of `CommandType` enums to differenciate the type of command to undo or redo. +Similar to `CommandMode`, the various `CommandType` enums are: + +** `CommandType.HEALTHWORKER_COMMAND` +** `CommandType.REQUEST_COMMAND` +** `CommandType.HEALTHWORKER_AND_REQUEST_COMMAND` -These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively. Given below is an example usage scenario and how the undo/redo mechanism behaves at each step. -Step 1. The user launches the application for the first time. The `VersionedAddressBook` will be initialized with the initial address book state, and the `currentStatePointer` pointing to that single address book state. +Step 1. The user launches the application for the first time. The `VersionedRequestBook` and `VersionedHealthWorkerBook` will be initialized with the initial state, + and the `currentStatePointer` for each `VersionedBook` pointing to that single book state. +Since no modify command has been called, the initial list of commands in `ModifyCommandHistory` is empty and the initial `currentStatePointer` of `ModifyCommandHistory` is initialized to -1. + +image::initrb.png[width="800"] +image::inithb.png[width="800"] -image::UndoRedoStartingStateListDiagram.png[width="800"] -Step 2. The user executes `delete 5` command to delete the 5th person in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state. +Step 2. The user executes `delete r 5` command to delete the 5th request in request book. The `delete r` command calls `Model#commit(REQUEST_COMMAND)`, causing the modified state of the request book after the `delete r 5` command executes to be saved in the `requestBookStateList`, and the `currentStatePointer` is shifted to the newly inserted request book state. +Since the request book is modified, the enum `REQUEST_COMMAND` is added to the `modifyCommandHistory` list within the `ModifyCommandHistory` class and the `currentStatePointer` is now pointing at the most recent command. +The `VersionedHealthWorkerBook` is unaffected. -image::UndoRedoNewCommand1StateListDiagram.png[width="800"] +image::rbafterdelete.png[width="800"] +image::mchafterdelete.png[width="800"] -Step 3. The user executes `add n/David ...` to add a new person. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`. +Step 3. The user executes `add h n/David ...` to add a new healthworker. The `add h` command also calls `Model#commit(HEALTHWORKER_COMMAND)`, causing a modified health worker book state to be saved into the `healthWorkerBookStateList` and the `currentStatePointer` is shifted to the new health worker book state. +The enum `HEALTHWORKER_COMMAND` is added into the `modifyCommandHistory` list of the `ModifyCommandHistory` class. +The `VersionedRequestBook` is unaffected. -image::UndoRedoNewCommand2StateListDiagram.png[width="800"] +image::hbafteradd.png[width="800"] +image::mchafteradd.png[width="800"] [NOTE] -If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`. +If a command fails its execution, it will not call `Model#commit()`, so the book state will not be saved into the `healthWorkerBookStateList` or `requestBookStateList`. -Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoAddressBook()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous address book state, and restores the address book to that state. +Step 4. The user now decides that adding the health worker was a mistake, and decides to undo that action by executing the `undo` command. +The `undo` command will call `Model#undo()`, which will first obtain the type of command that needs to be undone by caling `ModifyCommandHistory#getUndoCommand()`. In this case `HEALTHWORKER_COMMAND` is returned, and hence will call undo on `VersionedHealthWorkerBook`. It will shift the `currentStatePointer` once to the left, pointing it to the previous health worker book state, and restores the health worker book to that state. +The `currentStatePointer` of the `ModifyCommandHistory` also gets shifted once to the left, pointing it to the previous command. -image::UndoRedoExecuteUndoStateListDiagram.png[width="800"] +image::hbafterundo.png[width="800"] +image::mchafterundo.png[width="800"] [NOTE] -If the `currentStatePointer` is at index 0, pointing to the initial address book state, then there are no previous address book states to restore. The `undo` command uses `Model#canUndoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo. +If the `currentStatePointer` of both `VersionedHealthWorkerBook` and `VersionedRequestBook` is at index 0, pointing to the initial book state for both books, then there are no previous states to restore. The `undo` command uses `Model#canUndo()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo. + +[NOTE] +As of version 1.4, the only command that has modifies both the health worker book and the request book is `EditHealthWorkerCommand`. +It is the only command that has `CommandType.HEALTHWORKER_AND_REQUEST_COMMAND`. + + + +The user first enters the `undo` command in the command line interface. The logic manager processes the command as a string +and checks using the `AddressBookParser` is the string is a valid command. In this case, the parser sees that the command string +matches the `undo` command string and hence returns an `undo` command to the `LogicManager` which then calls `execute()` to execute the command. +The `execute()` method calls `Model#undo()` in which the model checks the `ModifyCommandHistory` for the correct `VersionedBook` that needs to be undone +and then calls `VersionedBook#undo()`. Upon a successful undo, the `UndoCommand` will return a successful result to the `LogicManager` +which will then the "Undo Success!" message will be displayed on the command line interface. The following sequence diagram shows how the undo operation works: -image::UndoRedoSequenceDiagram.png[width="800"] +image::UndoRedoSeqDiagram.png[width="800"] -The `redo` command does the opposite -- it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state. +The `redo` command does the opposite -- it calls `Model#redo()`, which first obtains the command type by calling `ModifyCommandHistory#getRedoCommand()` and based on the returned command type it shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the respective book to that state. [NOTE] -If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone address book states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. +If the `currentStatePointer` of both `VersionedBook` s are pointing to the latest state, then there are no undone book states to restore. The `redo` command uses `Model#canRedo()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. -Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged. +Step 5. The user then decides to execute the command `list r`. Commands that do not modify the books, such as `list r`, +will not call `Model#commit()`, `Model#undo()` or `Model#redo()`. Thus, the `VersionedBook` s and `ModyfiCommandHistory` do not change. -image::UndoRedoNewCommand3StateListDiagram.png[width="800"] +image::rbafterlist.png[width="800"] -Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow. +Step 6. The user executes `delete h 1`, which calls `Model#commit(HEALTHWORKER_COMMAND)`. Since the `currentStatePointer` is not pointing at the end of the `healthWorkerBookStateList`, all health worker book states after the `currentStatePointer` will be purged. +We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow. -image::UndoRedoNewCommand4StateListDiagram.png[width="800"] +image::hbafterdel.png[width="800"] +image::mchafteroverride.png[width="800"] The following activity diagram summarizes what happens when a user executes a new command: -image::UndoRedoActivityDiagram.png[width="650"] +image::UndoRedoActDiagram.png[width="650"] ==== Design Considerations + ===== Aspect: How undo & redo executes +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +|Implementation |Saves the entire book (Current implementation) | Individual command knows how to undo/redo by itself. +|Pros| Less prone to bugs since the we are switching between different versions of the books. | Will use less memory (e.g. for `delete`, just save the person being deleted). +|Cons| May have performance issues in terms of memory usage especially for +large numbers of health workers and requests.| Every command will have their own implementation of undo and some of them are slow hence it causes performance issues. +(e.g. for `clr`, all requests that were deleted have to be added back into the list, which will be quite slow if +there is a large number of requests).| +|======================================================================= -* **Alternative 1 (current choice):** Saves the entire address book. -** Pros: Easy to implement. -** Cons: May have performance issues in terms of memory usage. -* **Alternative 2:** Individual command knows how to undo/redo by itself. -** Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). -** Cons: We must ensure that the implementation of each individual command are correct. ===== Aspect: Data structure to support the undo/redo commands +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +|Implementation | Use a list to store the history of book states.(Current implementation) | Use `HistoryManager` for undo/redo +|Pros| Undo and redo commands runs faster since it only involves the switching of the state pointer.| Supports multiple books with the `HistoryManager` alone since we are undoing from the command history. +|Cons| Need multiple `VersionedBook` s. One or each type of book.| `HistoryManager` keeps a record of all commands, even if they are invalid or commands that does not call `Model#commit()`. +Traversing these irrelevant commands to find the next undoable command will take a long time especially if size of history is large.| +|======================================================================= + +===== Aspect: Data structure to handle multiple `VersionedBooks` +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +|Implementation | Use a command history to keep track +of the type of book that was modified It is represented as a list of `CommandType`.(Current implementation) | Use a list of pairs. Each state is represented as a pair which stores the `currentStatePointer` of each book. +|Pros| Easily scalable to include more than two books. As the developer can simply add an extra `CommandType` +and extra cases for switch statements.| Supports commands that change multiple books at once since it keeps track of all states. +|Cons| Unable to scale as well if there are many commands that modifies multiple books at once.| Keeping multiple integers takes up more memory as compared to keeping a single enum. +|======================================================================= -* **Alternative 1 (current choice):** Use a list to store the history of address book states. -** Pros: Easy for new Computer Science student undergraduates to understand, who are likely to be the new incoming developers of our project. -** Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both `HistoryManager` and `VersionedAddressBook`. -* **Alternative 2:** Use `HistoryManager` for undo/redo -** Pros: We do not need to maintain a separate list, and just reuse what is already in the codebase. -** Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as `HistoryManager` now needs to do two different things. // end::undoredo[] -// tag::dataencryption[] -=== [Proposed] Data Encryption +// tag::setreminder[] +=== Set Reminder Feature + +The `setreminder` command gives the user an option to set a reminder with a customised message. +The reminder is in the form of an `AlertDialog` and is scheduled to display on the UI by a `TimerTask` at time +`t + current time`, where `t` is time in the format `hh:mm:ss`. + + +==== Current Implementation + +The following sequence diagram shows the sequence flow from when the `SetReminderCommandParser` receives the command and +parses it into a `SetReminderCommand` object. + +image::SetReminderSequenceDiagram.png[width="800"] +Figure 3.9.1 shows the sequence diagram for the different method invocation calls between the classes + +1. When `SetReminderCommandParser` receives the `parse` command, it calls the static method `ArgumentTokenizer.tokenize` to extract the arguments from the user input string. + +2. The `extractArguments` constructs and returns an `ArgumentMultimap` based on the arguments passed in. + +3. `SetReminderCommandParser` checks if there are arguments specified under prefixes `PREFIX_TIME` and `PREFIX_MESSAGE`. + +4. If it cannot find those arguments, it throws a `ParseException` to the calling program. + +5. If arguments are available, it calls the `getValue` method of `ArgumentMultimap` to return the values + +6. After getting the values, the `SetReminderCommandParser` checks for the validity of the values and if true, calls the constructor of `SetReminderCommand` +// end::setreminder[] + +// tag::statistics[] +=== Statistics Feature + +The statistics mechanism is facilitated by Statistics class, which is a public Java class containing a private static +TreeMap data structure and a private static LinkedHashMap data structure. The TreeMap contains key-value pairs, with the +names of health conditions as keys and the number of occurrences of each health condition as corresponding values. The +key-value pairs in the TreeMap are ordered in lexicographical order, whereas the LinkedHashMap is ordered in descending +order by value. + +The statistics feature is called every time the user decides to use any request-related commands (such as `add request`, +`edit r`, `delete r`, `undo`, `redo`, `clr`) since statistics need to keep track of every change in the frequency of all health +conditions. Therefore, the Statistics class also carries out the following operations: + +• updateStatistics(): updates statistics with new health condition-related data after add or edit commands are called +by the user. +• deleteStatistics(): updates statistics by specifically removing the health condition-related data that need to be +removed after the user calls the delete function. +• sortStatistics(): sorts statistics by value in descending order of the number of occurrences of each health +conditions, and puts the ordered key-value pairs into sortedMap +• undoRedoStatistics(): clears statistics and sortedMap completely and uses an ObservableList of all requests in the +request book to extract all the health conditions and their related number of occurrences. These health conditions and +their statistics are then added back to statistics and sortedMap +• clearStatistics(): renders both statistics and sortedMap empty after the user calls for the clr operation +• getConditionStatistics(): when the user specifically wants to know the number of occurrences for a particular health +condition + +Given below is an example of a usage scenario and how the statistics command is executed at each step: + +1. Starting up HealthHub: The user launches HealthHub for the first time. The `statistics` and `sortedMap` will be +initialized as an empty TreeMap and an empty LinkedHashMap respectively. + +2. Issuing Add Request Command: The user executes `add request n/John Doe i/S8974421C p/98765432 a/123 Brick Road, +#01-01 dt/01-01-2019 14:50:00 c/Diabetes c/Physiotherapy` command to add John Doe to the request book. The +aforementioned command also calls updateStatistics(), which takes in a Set containing Diabetes Condition and +Physiotherapy Condition, and adds an occurrence of one each to statistics. sortStatistics() is then subsequently called +to order the health conditions by value in sortedMap. + +3. Issuing Edit Request Command: The user executes `edit r 1 c/Diabetes` command to make changes to the first request +on the request panel in HealthHub. The aforementioned command also calls deleteStatistics(), which removes the +statistics of health conditions of the first request in statistics. updateStatistics() is then subsequently called to +add the new health condition (which in this case is just Diabetes) to statistics. sortStatistics() is lastly called to +order the health conditions by value in sortedMap. +4. Issuing Undo Request Command: The user executes `undo` command to reverse his earlier `edit r 1 c/Diabetes` command. +The aforementioned commands calls undoRedoStatistics(). This method first clears statistics and sortedMap, and then +takes an ObservableList of all requests from the request book. All health conditions are retrieved from the requests, +and are used to update statistics and sortedMap. + +The following sequence shows how the statistics operation works when called by LogicManager: + +image::statistics_command_sequence.png[] + +The following activity diagram summarizes what happens when a HealthHub user executes a new command: + +image::statistics_activity_diagram.png[] + +==== Design Considerations + +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +| Aspect +| Alternative 1 +| Alternative 2 + +| Choice of data structure for statistics and sortedMap +| statistics: use TreeMap + + sortedMap: use LinkedHashMap + +*Advantages*: + +1. Very fast retrieval of information with the TreeMap; guaranteed O(lgn) time complexity for containsKey, get, put, +remove operations. + +2. TreeMap entries are sorted in the natural ordering of its keys. + +3. Having 2 separate data structures (1 to contain alphabetically arranged health conditions and 1 to contain sorted +conditions by value) aids in the quicker retrieval of data + + +*Disadvantages*: + +1. Space costly to have 2 separate data structures containing the same information but in different orders + +| Use any other reasonable data structure like an ArrayList or a LinkedList + +*Advantages*: + +1. Very easy to implement and understand + +2. Space-efficient to have only 1 list of health conditions and their corresponding number of occurrences + +*Disadvantages*: + +1. Will need to create another wrapper class around Conditions and their number of occurrences since lists do not allow +for key-value pairing + +2. Retrieval of information for common operations like getting statistics for a particular condition may not be very +fast + +|======================================================================= + +Decision to go with Alternative 1: The team prioritized speed over space since in hospitals, should they want to +implement HealthHub, will not have an issue with having memory constraints. But they would definitely want to retrieve +data as fast as possible. Moreover, Alternative 1 seems far more scalable for future developments + +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +| Aspect +| Alternative 1 +| Alternative 2 + +| How `statistics` executes +| The system saves an internal copy of statistics in its storage like a StatisticsBook, modelled after RequestBook or +HealthWorkerBook + +*Advantages*: + + 1. When HealthHub is closed and reopened, the old statistics will still exist. + +*Disadvantages*: + + 1. Takes up memory space since statistics will now need to be stored as .json files + + 2. Speed of retrieval will be lower since HealthHub will need to dig into its storage for data + +| Make the statistics class a static class. + +*Advantages*: + +1. Easier to implement; entirely removes the need for making storage files + +2. Speed of retrieval of data will be faster since it does not constantly need to keep digging into storage files -_{Explain here how the data encryption feature will be implemented}_ +*Disadvantages*: -// end::dataencryption[] +1. When HealthHub is closed and reopened, the old statistics will disappear since they have not been stored. -=== Logging +|======================================================================= + +Decision to go with Alternative 2: Since RequestBook was already being stored in the storage component of HealthHub, +I found it redundant and space-inefficient to have to create another StatisticsBook to store statistical data, since all +of my statistical information can be found from the requests stored in RequestBook. I made sure that whenever +request-related commands were being executed (add, edit, delete, undo, redo, clr) statistics was also being updated in +tandem so that the statistical data was always accurate in real-time. + +To address the issue of losing statistical data upon closing down and reopening HealthHub, I have ensured that +statistics and sortedMap are initialized with latest data from the RequestBook during the init() method in the MainApp. + +// end::statistics[] + + +// tag::autocomplete[] +=== Autocomplete Feature for CommandBox +The UI component, `CommandBox`, comes with a `TextField` component in AB4. For Health Hub, the `TextField` is replaced +with an `AutoCompleteTextField` class that extends from the parent class, `TextField`. + +In the `AutoCompleteTextField` class, it adds an additional listener to the `textProperty()` of `TextField` class, to register for when +a text input is being sensed and generates the suggestion box in the form of a `ContextMenu` to the user. + +image::AutoCompleteTextFieldSMD.png[] +Figure 3.11.1 shows the state machine diagram for the `AutoCompleteTextField` behaviour when it listens for a user input. + +The searching of which commands to display to the user as suggestions is done by iterating the `suggestions` data structure, which is a `TreeSet`, then checking +against the user's input if any of the suggestions starts with the user's text. + +==== Aspect: Data structure to store the list of commands +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +Implementation | Use a `TreeSet` data structure | Use a `SuffixTree` data structure +|Pros| Implements the `NavigatableSet` interface and guarantees that elements are stored in sorted order, also allows for _O(log n)_ time complexity for dynamic searching of elements. | Made for features like autocompletion, allows particularly fast implementation of `String` operations. +|Cons| Elements contained within the `TreeSet` data have to be a _Comparable_ or a _Comparator_ needs to be supplied. In this case, since we are only concerned with `Strings`, we do not +need an extra step. | Suffix Trees are difficult to comprehend -> difficult to implement. +|======================================================================= +// end::autocomplete[] +== Logging We are using `java.util.logging` package for logging. The `LogsCenter` class is used to manage the logging levels and logging destinations. * The logging level can be controlled using the `logLevel` setting in the configuration file (See <>) @@ -447,9 +1318,27 @@ The SE-EDU team does not provide support for modified template files. [[Testing]] == Testing +Testing is an important component of the development pipeline for HealthHub. +With each new feature that is implemented, new tests for the fresh feature +must also be included to ensure robustness and validation of the feature. In +addition, regression testing using existing tests already implemented is also + extensively done to ensure that the application functions without unintended + side effects. In following sections, we will be elaborating on how you can + adopt the testing suite implementation that is in place in HealthHub. + === Running Tests -There are three ways to run tests. +For the testing phase in HealthHub, we will be using a testing framework +called *JUnit* that is specialised to run tests for software built in Java. + +[NOTE] +==== +Not sure how JUnit works? Head over to the JUnit website and take a look at +their User Guide at this link: +https://junit.org/junit5/docs/current/user-guide/ +==== + +There are three ways to run tests in HealthHub. [TIP] The most reliable way to run tests is the 3rd one. The first two methods might fail some GUI tests due to platform/resolution-specific idiosyncrasies. @@ -487,6 +1376,15 @@ e.g. `seedu.address.storage.StorageManagerTest` .. Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together. + e.g. `seedu.address.logic.LogicManagerTest` +=== Generation of test files + +We use classes located in the `seedu.address.jsonfilegenerator` folder to generate JSON +test files. + +Developers are free to modify the code within the classes to generate healthworker/request +book containing the respective data they need for tests by using the `HealthWorkerBuilder` + and `RequestBuilder` classes + +All test file generator classes contains a main function and hence can be ran independently by compiling the file. + === Troubleshooting Testing **Problem: `HelpWindowTest` fails with a `NullPointerException`.** @@ -496,16 +1394,32 @@ e.g. `seedu.address.logic.LogicManagerTest` == Dev Ops +As HealthHub grows larger as a software development project due to addition +of new features or overhauling of existing ones, we have also deployed the +use of various build automation tools in order to efficiently integrate the +components of HealthHub together during the build process. This allows of +greater efficiency and scalability when introducing new implementations into +the project. + === Build Automation -See <> to learn how to use Gradle for build automation. +See <> to learn how to use Gradle for build +automation on your local machine for efficient project builds. === Continuous Integration -We use https://travis-ci.org/[Travis CI] and https://www.appveyor.com/[AppVeyor] to perform _Continuous Integration_ on our projects. See <> and <> for more details. +We use https://travis-ci.org/[Travis CI] and https://www.appveyor +.com/[AppVeyor] to perform _Continuous Integration_ on our projects to allow +for more seamless and parallel coding performance between team members. See +<> and <> for more details. === Coverage Reporting +Coverage represents the portion of the software codebase that has been tested + for using various testing frameworks, such as JUnit. This allows the + development to track how extensive the testing of new features are to ensure + that their features are correctly implemented with minimal bugs. + We use https://coveralls.io/[Coveralls] to track the code coverage of our projects. See <> for more details. === Documentation Previews @@ -522,7 +1436,10 @@ Here are the steps to create a new release. === Managing Dependencies -A project often depends on third-party libraries. For example, Address Book depends on the https://github.com/FasterXML/jackson[Jackson library] for JSON parsing. Managing these _dependencies_ can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives: +With a huge number of different components in HealthHub, the project also +includes use of various third party libraries to efficiently support new and +existing features in HealthHub, some of which includes for example the +https://github.com/FasterXML/jackson[Jackson library] for JSON parsing. Managing these _dependencies_ can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives: [loweralpha] . Include those libraries in the repo (this bloats the repo size) @@ -530,294 +1447,23 @@ A project often depends on third-party libraries. For example, Address Book depe [[GetStartedProgramming]] [appendix] -== Suggested Programming Tasks to Get Started - -Suggested path for new programmers: - -1. First, add small local-impact (i.e. the impact of the change does not go beyond the component) enhancements to one component at a time. Some suggestions are given in <>. - -2. Next, add a feature that touches multiple components to learn how to implement an end-to-end feature across all components. <> explains how to go about adding such a feature. - -[[GetStartedProgramming-EachComponent]] -=== Improving each component - -Each individual exercise in this section is component-based (i.e. you would not need to modify the other components to get it to work). - -[discrete] -==== `Logic` component - -*Scenario:* You are in charge of `logic`. During dog-fooding, your team realize that it is troublesome for the user to type the whole command in order to execute a command. Your team devise some strategies to help cut down the amount of typing necessary, and one of the suggestions was to implement aliases for the command words. Your job is to implement such aliases. - -[TIP] -Do take a look at <> before attempting to modify the `Logic` component. - -. Add a shorthand equivalent alias for each of the individual commands. For example, besides typing `clear`, the user can also type `c` to remove all persons in the list. -+ -**** -* Hints -** Just like we store each individual command word constant `COMMAND_WORD` inside `*Command.java` (e.g. link:{repoURL}/src/main/java/seedu/address/logic/commands/FindCommand.java[`FindCommand#COMMAND_WORD`], link:{repoURL}/src/main/java/seedu/address/logic/commands/DeleteCommand.java[`DeleteCommand#COMMAND_WORD`]), you need a new constant for aliases as well (e.g. `FindCommand#COMMAND_ALIAS`). -** link:{repoURL}/src/main/java/seedu/address/logic/parser/AddressBookParser.java[`AddressBookParser`] is responsible for analyzing command words. -* Solution -** Modify the switch statement in link:{repoURL}/src/main/java/seedu/address/logic/parser/AddressBookParser.java[`AddressBookParser#parseCommand(String)`] such that both the proper command word and alias can be used to execute the same intended command. -** Add new tests for each of the aliases that you have added. -** Update the user guide to document the new aliases. -** See this https://github.com/se-edu/addressbook-level4/pull/785[PR] for the full solution. -**** - -[discrete] -==== `Model` component - -*Scenario:* You are in charge of `model`. One day, the `logic`-in-charge approaches you for help. He wants to implement a command such that the user is able to remove a particular tag from everyone in the address book, but the model API does not support such a functionality at the moment. Your job is to implement an API method, so that your teammate can use your API to implement his command. - -[TIP] -Do take a look at <> before attempting to modify the `Model` component. - -. Add a `removeTag(Tag)` method. The specified tag will be removed from everyone in the address book. -+ -**** -* Hints -** The link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model`] and the link:{repoURL}/src/main/java/seedu/address/model/AddressBook.java[`AddressBook`] API need to be updated. -** Think about how you can use SLAP to design the method. Where should we place the main logic of deleting tags? -** Find out which of the existing API methods in link:{repoURL}/src/main/java/seedu/address/model/AddressBook.java[`AddressBook`] and link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`] classes can be used to implement the tag removal logic. link:{repoURL}/src/main/java/seedu/address/model/AddressBook.java[`AddressBook`] allows you to update a person, and link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`] allows you to update the tags. -* Solution -** Implement a `removeTag(Tag)` method in link:{repoURL}/src/main/java/seedu/address/model/AddressBook.java[`AddressBook`]. Loop through each person, and remove the `tag` from each person. -** Add a new API method `deleteTag(Tag)` in link:{repoURL}/src/main/java/seedu/address/model/ModelManager.java[`ModelManager`]. Your link:{repoURL}/src/main/java/seedu/address/model/ModelManager.java[`ModelManager`] should call `AddressBook#removeTag(Tag)`. -** Add new tests for each of the new public methods that you have added. -** See this https://github.com/se-edu/addressbook-level4/pull/790[PR] for the full solution. -**** - -[discrete] -==== `Ui` component - -*Scenario:* You are in charge of `ui`. During a beta testing session, your team is observing how the users use your address book application. You realize that one of the users occasionally tries to delete non-existent tags from a contact, because the tags all look the same visually, and the user got confused. Another user made a typing mistake in his command, but did not realize he had done so because the error message wasn't prominent enough. A third user keeps scrolling down the list, because he keeps forgetting the index of the last person in the list. Your job is to implement improvements to the UI to solve all these problems. - -[TIP] -Do take a look at <> before attempting to modify the `UI` component. - -. Use different colors for different tags inside person cards. For example, `friends` tags can be all in brown, and `colleagues` tags can be all in yellow. -+ -**Before** -+ -image::getting-started-ui-tag-before.png[width="300"] -+ -**After** -+ -image::getting-started-ui-tag-after.png[width="300"] -+ -**** -* Hints -** The tag labels are created inside link:{repoURL}/src/main/java/seedu/address/ui/PersonCard.java[the `PersonCard` constructor] (`new Label(tag.tagName)`). https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Label.html[JavaFX's `Label` class] allows you to modify the style of each Label, such as changing its color. -** Use the .css attribute `-fx-background-color` to add a color. -** You may wish to modify link:{repoURL}/src/main/resources/view/DarkTheme.css[`DarkTheme.css`] to include some pre-defined colors using css, especially if you have experience with web-based css. -* Solution -** You can modify the existing test methods for `PersonCard` 's to include testing the tag's color as well. -** See this https://github.com/se-edu/addressbook-level4/pull/798[PR] for the full solution. -*** The PR uses the hash code of the tag names to generate a color. This is deliberately designed to ensure consistent colors each time the application runs. You may wish to expand on this design to include additional features, such as allowing users to set their own tag colors, and directly saving the colors to storage, so that tags retain their colors even if the hash code algorithm changes. -**** - -. Modify link:{repoURL}/src/main/java/seedu/address/commons/events/ui/NewResultAvailableEvent.java[`NewResultAvailableEvent`] such that link:{repoURL}/src/main/java/seedu/address/ui/ResultDisplay.java[`ResultDisplay`] can show a different style on error (currently it shows the same regardless of errors). -+ -**Before** -+ -image::getting-started-ui-result-before.png[width="200"] -+ -**After** -+ -image::getting-started-ui-result-after.png[width="200"] -+ -**** -* Hints -** link:{repoURL}/src/main/java/seedu/address/commons/events/ui/NewResultAvailableEvent.java[`NewResultAvailableEvent`] is raised by link:{repoURL}/src/main/java/seedu/address/ui/CommandBox.java[`CommandBox`] which also knows whether the result is a success or failure, and is caught by link:{repoURL}/src/main/java/seedu/address/ui/ResultDisplay.java[`ResultDisplay`] which is where we want to change the style to. -** Refer to link:{repoURL}/src/main/java/seedu/address/ui/CommandBox.java[`CommandBox`] for an example on how to display an error. -* Solution -** Modify link:{repoURL}/src/main/java/seedu/address/commons/events/ui/NewResultAvailableEvent.java[`NewResultAvailableEvent`] 's constructor so that users of the event can indicate whether an error has occurred. -** Modify link:{repoURL}/src/main/java/seedu/address/ui/ResultDisplay.java[`ResultDisplay#handleNewResultAvailableEvent(NewResultAvailableEvent)`] to react to this event appropriately. -** You can write two different kinds of tests to ensure that the functionality works: -*** The unit tests for `ResultDisplay` can be modified to include verification of the color. -*** The system tests link:{repoURL}/src/test/java/systemtests/AddressBookSystemTest.java[`AddressBookSystemTest#assertCommandBoxShowsDefaultStyle() and AddressBookSystemTest#assertCommandBoxShowsErrorStyle()`] to include verification for `ResultDisplay` as well. -** See this https://github.com/se-edu/addressbook-level4/pull/799[PR] for the full solution. -*** Do read the commits one at a time if you feel overwhelmed. -**** - -. Modify the link:{repoURL}/src/main/java/seedu/address/ui/StatusBarFooter.java[`StatusBarFooter`] to show the total number of people in the address book. -+ -**Before** -+ -image::getting-started-ui-status-before.png[width="500"] -+ -**After** -+ -image::getting-started-ui-status-after.png[width="500"] -+ -**** -* Hints -** link:{repoURL}/src/main/resources/view/StatusBarFooter.fxml[`StatusBarFooter.fxml`] will need a new `StatusBar`. Be sure to set the `GridPane.columnIndex` properly for each `StatusBar` to avoid misalignment! -** link:{repoURL}/src/main/java/seedu/address/ui/StatusBarFooter.java[`StatusBarFooter`] needs to initialize the status bar on application start, and to update it accordingly whenever the address book is updated. -* Solution -** Modify the constructor of link:{repoURL}/src/main/java/seedu/address/ui/StatusBarFooter.java[`StatusBarFooter`] to take in the number of persons when the application just started. -** Use link:{repoURL}/src/main/java/seedu/address/ui/StatusBarFooter.java[`StatusBarFooter#handleAddressBookChangedEvent(AddressBookChangedEvent)`] to update the number of persons whenever there are new changes to the addressbook. -** For tests, modify link:{repoURL}/src/test/java/guitests/guihandles/StatusBarFooterHandle.java[`StatusBarFooterHandle`] by adding a state-saving functionality for the total number of people status, just like what we did for save location and sync status. -** For system tests, modify link:{repoURL}/src/test/java/systemtests/AddressBookSystemTest.java[`AddressBookSystemTest`] to also verify the new total number of persons status bar. -** See this https://github.com/se-edu/addressbook-level4/pull/803[PR] for the full solution. -**** - -[discrete] -==== `Storage` component - -*Scenario:* You are in charge of `storage`. For your next project milestone, your team plans to implement a new feature of saving the address book to the cloud. However, the current implementation of the application constantly saves the address book after the execution of each command, which is not ideal if the user is working on limited internet connection. Your team decided that the application should instead save the changes to a temporary local backup file first, and only upload to the cloud after the user closes the application. Your job is to implement a backup API for the address book storage. - -[TIP] -Do take a look at <> before attempting to modify the `Storage` component. - -. Add a new method `backupAddressBook(ReadOnlyAddressBook)`, so that the address book can be saved in a fixed temporary location. -+ -**** -* Hint -** Add the API method in link:{repoURL}/src/main/java/seedu/address/storage/AddressBookStorage.java[`AddressBookStorage`] interface. -** Implement the logic in link:{repoURL}/src/main/java/seedu/address/storage/StorageManager.java[`StorageManager`] and link:{repoURL}/src/main/java/seedu/address/storage/JsonAddressBookStorage.java[`JsonAddressBookStorage`] class. -* Solution -** See this https://github.com/se-edu/addressbook-level4/pull/594[PR] for the full solution. -**** - -[[GetStartedProgramming-RemarkCommand]] -=== Creating a new command: `remark` - -By creating this command, you will get a chance to learn how to implement a feature end-to-end, touching all major components of the app. - -*Scenario:* You are a software maintainer for `addressbook`, as the former developer team has moved on to new projects. The current users of your application have a list of new feature requests that they hope the software will eventually have. The most popular request is to allow adding additional comments/notes about a particular contact, by providing a flexible `remark` field for each contact, rather than relying on tags alone. After designing the specification for the `remark` command, you are convinced that this feature is worth implementing. Your job is to implement the `remark` command. - -==== Description -Edits the remark for a person specified in the `INDEX`. + -Format: `remark INDEX r/[REMARK]` - -Examples: - -* `remark 1 r/Likes to drink coffee.` + -Edits the remark for the first person to `Likes to drink coffee.` -* `remark 1 r/` + -Removes the remark for the first person. - -==== Step-by-step Instructions - -===== [Step 1] Logic: Teach the app to accept 'remark' which does nothing -Let's start by teaching the application how to parse a `remark` command. We will add the logic of `remark` later. - -**Main:** - -. Add a `RemarkCommand` that extends link:{repoURL}/src/main/java/seedu/address/logic/commands/Command.java[`Command`]. Upon execution, it should just throw an `Exception`. -. Modify link:{repoURL}/src/main/java/seedu/address/logic/parser/AddressBookParser.java[`AddressBookParser`] to accept a `RemarkCommand`. - -**Tests:** - -. Add `RemarkCommandTest` that tests that `execute()` throws an Exception. -. Add new test method to link:{repoURL}/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java[`AddressBookParserTest`], which tests that typing "remark" returns an instance of `RemarkCommand`. - -===== [Step 2] Logic: Teach the app to accept 'remark' arguments -Let's teach the application to parse arguments that our `remark` command will accept. E.g. `1 r/Likes to drink coffee.` - -**Main:** - -. Modify `RemarkCommand` to take in an `Index` and `String` and print those two parameters as the error message. -. Add `RemarkCommandParser` that knows how to parse two arguments, one index and one with prefix 'r/'. -. Modify link:{repoURL}/src/main/java/seedu/address/logic/parser/AddressBookParser.java[`AddressBookParser`] to use the newly implemented `RemarkCommandParser`. - -**Tests:** - -. Modify `RemarkCommandTest` to test the `RemarkCommand#equals()` method. -. Add `RemarkCommandParserTest` that tests different boundary values -for `RemarkCommandParser`. -. Modify link:{repoURL}/src/test/java/seedu/address/logic/parser/AddressBookParserTest.java[`AddressBookParserTest`] to test that the correct command is generated according to the user input. - -===== [Step 3] Ui: Add a placeholder for remark in `PersonCard` -Let's add a placeholder on all our link:{repoURL}/src/main/java/seedu/address/ui/PersonCard.java[`PersonCard`] s to display a remark for each person later. - -**Main:** - -. Add a `Label` with any random text inside link:{repoURL}/src/main/resources/view/PersonListCard.fxml[`PersonListCard.fxml`]. -. Add FXML annotation in link:{repoURL}/src/main/java/seedu/address/ui/PersonCard.java[`PersonCard`] to tie the variable to the actual label. - -**Tests:** - -. Modify link:{repoURL}/src/test/java/guitests/guihandles/PersonCardHandle.java[`PersonCardHandle`] so that future tests can read the contents of the remark label. - -===== [Step 4] Model: Add `Remark` class -We have to properly encapsulate the remark in our link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`] class. Instead of just using a `String`, let's follow the conventional class structure that the codebase already uses by adding a `Remark` class. - -**Main:** - -. Add `Remark` to model component (you can copy from link:{repoURL}/src/main/java/seedu/address/model/person/Address.java[`Address`], remove the regex and change the names accordingly). -. Modify `RemarkCommand` to now take in a `Remark` instead of a `String`. - -**Tests:** - -. Add test for `Remark`, to test the `Remark#equals()` method. - -===== [Step 5] Model: Modify `Person` to support a `Remark` field -Now we have the `Remark` class, we need to actually use it inside link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`]. - -**Main:** - -. Add `getRemark()` in link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`]. -. You may assume that the user will not be able to use the `add` and `edit` commands to modify the remarks field (i.e. the person will be created without a remark). -. Modify link:{repoURL}/src/main/java/seedu/address/model/util/SampleDataUtil.java/[`SampleDataUtil`] to add remarks for the sample data (delete your `data/addressbook.json` so that the application will load the sample data when you launch it.) - -===== [Step 6] Storage: Add `Remark` field to `JsonAdaptedPerson` class -We now have `Remark` s for `Person` s, but they will be gone when we exit the application. Let's modify link:{repoURL}/src/main/java/seedu/address/storage/JsonAdaptedPerson.java[`JsonAdaptedPerson`] to include a `Remark` field so that it will be saved. - -**Main:** - -. Add a new JSON field for `Remark`. - -**Tests:** - -. Fix `invalidAndValidPersonAddressBook.json`, `typicalPersonsAddressBook.json`, `validAddressBook.json` etc., such that the JSON tests will not fail due to a missing `remark` field. - -===== [Step 6b] Test: Add withRemark() for `PersonBuilder` -Since `Person` can now have a `Remark`, we should add a helper method to link:{repoURL}/src/test/java/seedu/address/testutil/PersonBuilder.java[`PersonBuilder`], so that users are able to create remarks when building a link:{repoURL}/src/main/java/seedu/address/model/person/Person.java[`Person`]. - -**Tests:** - -. Add a new method `withRemark()` for link:{repoURL}/src/test/java/seedu/address/testutil/PersonBuilder.java[`PersonBuilder`]. This method will create a new `Remark` for the person that it is currently building. -. Try and use the method on any sample `Person` in link:{repoURL}/src/test/java/seedu/address/testutil/TypicalPersons.java[`TypicalPersons`]. - -===== [Step 7] Ui: Connect `Remark` field to `PersonCard` -Our remark label in link:{repoURL}/src/main/java/seedu/address/ui/PersonCard.java[`PersonCard`] is still a placeholder. Let's bring it to life by binding it with the actual `remark` field. - -**Main:** - -. Modify link:{repoURL}/src/main/java/seedu/address/ui/PersonCard.java[`PersonCard`]'s constructor to bind the `Remark` field to the `Person` 's remark. - -**Tests:** - -. Modify link:{repoURL}/src/test/java/seedu/address/ui/testutil/GuiTestAssert.java[`GuiTestAssert#assertCardDisplaysPerson(...)`] so that it will compare the now-functioning remark label. - -===== [Step 8] Logic: Implement `RemarkCommand#execute()` logic -We now have everything set up... but we still can't modify the remarks. Let's finish it up by adding in actual logic for our `remark` command. - -**Main:** - -. Replace the logic in `RemarkCommand#execute()` (that currently just throws an `Exception`), with the actual logic to modify the remarks of a person. - -**Tests:** - -. Update `RemarkCommandTest` to test that the `execute()` logic works. - -==== Full Solution - -See this https://github.com/se-edu/addressbook-level4/pull/599[PR] for the step-by-step solution. [appendix] == Product Scope *Target user profile*: -* has a need to manage a significant number of contacts -* prefer desktop apps over other types -* can type fast -* prefers typing over mouse input -* is reasonably comfortable using CLI apps +* Administrative staff in hospitals and healthcare organizations that also +manage requests from and services for home-care patients +* Administrative staff that are comfortable with typing on a CLI, as well as +a GUI. +* Aims to streamline the performance of keeping records of home-care +patients, and also assigning health staff to requests using technological +means. -*Value proposition*: manage contacts faster than a typical mouse/GUI driven app +*Value proposition*: manage requests from home-care patients, and handle +assignment of healthstaff for these requests much faster and efficient than +traditional methods of pen and paper documentation. [appendix] == User Stories @@ -828,34 +1474,60 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un |======================================================================= |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 +|`* * *` |user |Check the details of new or unassigned requests|See what requests have yet to be assigned a health worker and what type of request it is +|`* * *` |user |Assign a health worker to an existing request|Accept a pending request by assigning a new health worker who has the skillset to fufill the request at the time of the request +|`* * *` |user |Complete a request that is currently ongoing|Label the request as completed once the health worker completes his/her task -|`* * *` |user |add a new person | +|`* * *` |user |Register a new health worker| +|`* * *` |user |delete a healthworker |remove healthworkers that are no longer in our hospital database +|`* * *` |user |find a healthworker by name |locate details of persons without having to go through the entire list -|`* * *` |user |delete a person |remove entries that I no longer need +|`* * *` |user |Check the professional details of existing health workers|Identify which health worker has the appropriate skillsets and certificates to fufill the corresponding requests +|`* * *` |user |Register a new request |Key in a new request from a patient with the specific request and patient details +|`* *` |user handling many requests at once|Identify the number of requests and their proportion|Immediately see which type of requests have the most demand -|`* * *` |user |find a person by name |locate details of persons without having to go through the entire list -|`* *` |user |hide <> by default |minimize chance of someone else seeing them by accident +|`* *` |user |filter requests by type|Perform assignment of staff of tasks of a specific type +|`* *` |user |Delete a request|Remove a request that is no longer valid or cancelled -|`*` |user with many persons in the address book |sort persons by name |locate a person easily |======================================================================= -_{More to be added}_ [appendix] == Use Cases -(For all use cases below, the *System* is the `AddressBook` and the *Actor* is the `user`, unless specified otherwise) +(For all use cases below, the *System* is the `HealthHub` and the *Actor* is the `user`, unless specified otherwise) + +[discrete] +=== Use case: Add health worker +1. User wants to register a new health worker. + +[none] +** 1.a. User enters the relevant health worker details into the system. + +[none] +** 2. Application registers the new health worker ++ +[none] +* Use case ends. +[none] +** 3a. The same health worker already exists inside the Application. ++ +[none] +*** 3a1. Application shows an error message. ++ +Use case ends. + [discrete] -=== Use case: Delete person +=== Use case: Delete health worker *MSS* -1. User requests to list persons -2. AddressBook shows a list of persons -3. User requests to delete a specific person in the list -4. AddressBook deletes the person +1. User requests to list health workers +2. Application shows a list of health workers +3. User requests to delete a specific health worker in the list +4. Application deletes the person + Use case ends. @@ -869,11 +1541,63 @@ Use case ends. * 3a. The given index is invalid. + [none] -** 3a1. AddressBook shows an error message. +** 3a1. Application shows an error message. + Use case resumes at step 2. -_{More to be added}_ +[discrete] +=== Use case: Add request +1. User wants to register a new request. + +[none] +** 1.a. User enters the relevant request details into the system. + +[none] +** 2. Application registers the new request ++ +Use case ends. + +** 3a. The same request already exists inside the Application. ++ +[none] +*** 3a1. Application shows an error message. ++ +Use case ends. + + +[discrete] +=== Use case: Assign requests to worker + +1. User wants to view the list of open requests. +[none] +* 1.a. User does not know command for listing requests: +* 1.a1. User enters the help command to look up the command for listing all requests. +2. Application displays list of open requests. +3. User wants to assign a health worker to a request. +[none] +* 3.a. No free health worker during the specified time slot for assignment: +** 3.a1 Request is left open. +* Use case ends. +* 3.b.No health worker with the necessary skillsets/certifications: +* 3.b1. Request is left open. +Use case ends. +4. Free health worker that has the necessary certifications and with the closest +proximity to the patient address will be assigned to the request. +[none] +Use case ends. + +[discrete] +=== Use case: Delete requests +1. User wants to delete a request that is expired or invalid. +[none] +* 1.a. Specified request is not in Application +* Use case ends. +2. Application deletes the specified request. +[none] +* Use case ends. + + + [appendix] == Non Functional Requirements @@ -882,8 +1606,6 @@ _{More to be added}_ . Should be able to hold up to 1000 persons 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. -_{More to be added}_ - [appendix] == Glossary @@ -893,27 +1615,12 @@ Windows, Linux, Unix, OS-X [[private-contact-detail]] Private contact detail:: A contact detail that is not meant to be shared with others -[appendix] -== Product Survey - -*Product Name* - -Author: ... - -Pros: - -* ... -* ... - -Cons: - -* ... -* ... - [appendix] == Instructions for Manual Testing -Given below are instructions to test the app manually. +In case of circumstances where manual testing needs to be done for HealthHub, + this section provides instructions on how to get started on manual testing + for the application. [NOTE] These instructions only provide a starting point for testers to work on; testers are expected to do more _exploratory_ testing. @@ -932,26 +1639,112 @@ These instructions only provide a starting point for testers to work on; testers .. Re-launch the app by double-clicking the jar file. + Expected: The most recent window size and location is retained. -_{ more test cases ... }_ - -=== Deleting a person -. Deleting a person while all persons are listed -.. Prerequisites: List all persons using the `list` command. Multiple persons in the list. -.. Test case: `delete 1` + - Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. -.. Test case: `delete 0` + - Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. -.. Other incorrect delete commands to try: `delete`, `delete x` (where x is larger than the list size) _{give more}_ + +=== Adding a `HealthWorker + +* Enter a valid `add healthworker` command with all compulsory fields +containing valid values. For example, you may try `add healthworker n/Dog Terr +p/92837710 i/S98817471Z o/NUH s/GENERAL_PRACTICE s/ORTHOPAEDIC` + + Message showing the successful addition of the `HealthWorker` will be +displayed in the command terminal, as well as the details of the newly added +`HealthWorker`. The newly added `HealthWorker` is now reflected immediately +in the GUI shown at the end of the list on the right. +* Enter an invalid `add healthworker` command. Some examples include: +** Missing fields: add healthworker p/92837710 i/S98817471Z o/NUH +s/GENERAL_PRACTICE s/ORTHOPAEDIC` (Missing name) + +An error message representing invalid command format will be displayed on the + command terminal, as well as the valid command format for the `add + healthworker` command. + +** Invalid fields: add healthworker n/Dog Terr p/92837710 i/A111Z o/NUH +s/GENERAL_PRACTICE s/ORTHOPAEDIC` (Invalid NRIC format) + +An error message is displayed that tells the user of the incorrect format for + a field whose value does not follow the correct format. If there are + multiple, the incorrect format of the first field whose value is invalid is + shown. + +=== Editing a `HealthWorker` + +* Enter a valid `edit healthworker` command with a valid index, and at least +one field to edit with a valid value. For example, you may try `edit +healthworker 1 p/91234567 n/John Doe` + +A status message that denotes the successful modification of the details of +an existing `HealthWorker` is shown on the command terminal. In addition, the + modified details of the `HealthWorker is immediately reflected on the list + in the GUI. + +* Enter an invalid `edit healthworker` command. Some examples include: +** Invalid index: `edit healthworker -1 n/John` + +An error message displays which informs the user that the index provided is +invalid. +** No field specified: `edit healthworker 1 ` + +An error message displays informing the user that at least one field to edit +must be provided. +** Invalid field: `edit healthworker 1 p/helloworld` + +An error message displays informing the user that the specific field +specified containing invalid values does not conform the field format. If +multiple invalid fields are entered, the first invalid one will be chosen as +the invalid format. + +=== Deleting a `HealthWorker` + +* Deleting a `HealthWorker` while all `HealthWorker` are listed: + +.. Prerequisites: List all `HealthWorker` using the `list healthworker` +command. Multiple `HealthWorker` in the list. +.. Test case: `delete healthworker 1` + + Expected: First `HealthWorker` is deleted from the list. Details of the + deleted `HealthWorker` shown in the status message. Timestamp in the status + bar is updated. +.. Test case: `delete healthworker 0` + + Expected: No `HealthWorker` is deleted. Error details shown in the status + message. Status bar remains the same. +.. Other incorrect delete commands to try: `delete`, delete healthworker`, +`delete healthworker x` (where x is larger than the list size), `delete healthworker y` (where y is negative) + Expected: Similar to previous. -_{ more test cases ... }_ +* Deleting a `HealthWorker` after a valid `filter healthworker` command is +issued: +.. Prerequisite: Enter the command `filter healthworker s/physiotherapy` to +display only `HealthWorker` that specialise in physiotherapy. Other valid +variants of the `filter healthworker` command may be used in place of this. +.. Test case: `delete healthworker 1` + + Expected: First `HealthWorker` is deleted from the filtered list. Details of + the deleted `HealthWorker` shown in the status message. Timestamp in the + status bar is updated. +.. Test case: `delete healthworker 0` + + Expected: No `HealthWorker` is deleted. Error details shown in the status + message. Status bar remains the same. +.. Other incorrect delete commands to try: `delete`, delete healthworker`, +`delete healthworker x` (where x is larger than the filtered list size), +`delete healthworker y` (where y is negative) + + Expected: Similar to previous. === Saving data . Dealing with missing/corrupted data files +.. If data file is missing, the app will retrieve a list of sample data internally. It will be saved upon exit. +.. If any of the data is corrupted, the app will start with empty books, adding a health worker +or request will overwrite the corrupted file. -.. _{explain how to simulate a missing/corrupted file and the expected behavior}_ +// tag::undoredo[] + +=== Undoing a command +. Undo a command that has been executed +.. Prerequisites: A command that modifies the data has been executed already, for example `delete r 1`. +.. Test case: `undo` + +Expected: The request has been deleted will appear back inside the list in its original position. +.. Test case: `undo` without any prerequisites + +Expected: The application will show an error message: No more commands to undo! + +=== Redoing a command +. Redo an undone command +.. Prerequisites: A successful undo command have to be executed already. +.. Test case: `redo` + +Expected: The application will redo the undone command. +.. Test case: `redo` without prerequisites + +Expected: The application will show an error message: No more commands to redo! -_{ more test cases ... }_ + +// end::undoredo[] diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 7e0070e12f49..557c430ddcc1 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -1,9 +1,10 @@ -= AddressBook Level 4 - User Guide += Health Hub - User Guide :site-section: UserGuide :toc: :toc-title: :toc-placement: preamble :sectnums: +:icons: font :imagesDir: images :stylesDir: stylesheets :xrefstyle: full @@ -12,249 +13,1079 @@ ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: endif::[] -:repoURL: https://github.com/se-edu/addressbook-level4 +:repoURL: https://github.com/CS2103-AY1819S2-W09-2/main -By: `Team SE-EDU` Since: `Jun 2016` Licence: `MIT` +By: `Team W9-02 (Health Hub)`      Since: `Jan 2019`      Licence: `MIT` == Introduction -AddressBook Level 4 (AB4) is for those who *prefer to use a desktop app for managing contacts*. More importantly, AB4 is *optimized for those who prefer to work with a Command Line Interface* (CLI) while still having the benefits of a Graphical User Interface (GUI). If you can type fast, AB4 can get your contact management tasks done faster than traditional GUI apps. Interested? Jump to the <> to get started. Enjoy! +Health Hub connects home care patients to qualified health care professionals seamlessly. + +Health Hub is a desktop application which allows health administrative staff to add, manage and close requests from +patients. These patients are people who do not require 24-hour round' the clock medical attention but perhaps some +other health care services such as the changing of tubing. + + +Health Hub provides a *Graphical User Interface* for administrative staff of health organizations and hospitals to manage requests +from all potential home stay patients, and is also *optimized for those who prefer to work with a Command Line Interface* (CLI). + + +Want to jump right into using Health Hub? Head over to <> to +install and configure the application, and you're good to go! + +== Notation + +* Words that are highlighted with a grey background in monospaced font +represent a `parameter` or `command` that is present or are to be used in the +application. + +* All numbers mentioned with commands begins with the number 1, representing the first item in the list. + +* Words that are highlighted in white represent a kbd:[keyboard] button that +can be pressed to invoke a described function. + +[NOTE] +==== +Documentation displayed under the this section may be additional useful +information regarding HealthHub. +==== + +[TIP] +==== +Information under this section denotes shortcuts and alternative commands to +the format of certain functions in HealthHub. +==== + +[WARNING] +==== +Information under this section highlights potential risks that may happen in +using a specific feature. +==== == Quick Start -. Ensure you have Java version `9` or later installed in your Computer. -. Download the latest `addressbook.jar` link:{repoURL}/releases[here]. -. Copy the file to the folder you want to use as the home folder for your Address Book. -. Double-click the file to start the app. The GUI should appear in a few seconds. -+ -image::Ui.png[width="790"] -+ +New to Health Hub? Follow our quick and easy steps below to get started on +Health Hub in no time! + +Before you start, ensure you have Java version `9` or later installed in your computer. + +[NOTE] +==== +If you do not have Java 9 installed, you may download the latest version of +the Java Runtime Environment at this link: https://www.oracle.com/technetwork/java/javase/downloads/index.html +==== + +Upon installing the application, click on the `healthhub.jar` file to open up + Health Hub. You should be greeted by the following interface: + +image::Ui_home.png[] . Type the command in the command box and press kbd:[Enter] to execute it. + e.g. typing *`help`* and pressing kbd:[Enter] will open the help window. . Some example commands you can try: -* *`list`* : lists all contacts -* **`add`**`n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` : adds a contact named `John Doe` to the Address Book. -* **`delete`**`3` : deletes the 3rd contact shown in the current list -* *`exit`* : exits the app +* *`list`* : lists all requests +* **`add`** `3 i/3 n/John Doe p/98765432 a/John street, block 123, #01-01` : +adds a patient named `John Doe` to the application. +* **`delete`** `4 n/4` : deletes the 4th request shown by the list command +* *`exit`* : exits the application, saving any changes made to the parameters + in the application. + +. Refer to <> for a detailed explanation of each command. + +== Change Log + +Returning user but not sure what has changed since you left? + +Listed below are the enhancements made to HealthHub, their version + releases and the respective improvement made: + +=== v1.1 Release Notes + +In this patch, the functionality to register new health workers into the +application has been implemented. Users may now also add new requests from +patients into Health Hub for future assignment using the `assign` command. + +* `add healthworker` command: Adds a health worker to the application, for +future assignment to open requests in HealtHub. For details on the +* `add request` command: Registers a new open request into the application. +The open request can then be assigned by the user using the `assign` command. + +For more explicit information on the `add` command, visit <>, +under Adding a Health Worker/Request. + +* `assign` command: Assigns an open request to an available health worker +that is already registered in the system + +=== v1.2 Release Notes + +Version 1.2 provides more utility to the application through the +implementation of the `edit` and `delete` commands that allow the user to +modify and remove requests and health workers from the application. -. Refer to <> for details of each command. +* `edit healthworker/h/1`: Modifies the details of an existing health staff +registered in Health Hub. +* `edit request/r/2`: Modifies the details of existing request records in the + application. + +For more explicit information on the `edit` command, visit <>, +under Editing a Health Worker/Request. + +=== v1.3 Release Notes + +With the release of version 1.3, we have set out to improve the already +simple and easy to use Health Hub with command shortcuts, as well as `filter` +command to easily search for staff with the skillset you are looking for. + +*Shortcuts*: + +* `add healthworker/h/1`: Adds a health worker to the application. +* `add request/r/2`: Registers a new request for the hospital management to attend to. + +*Filtering requests and health workers*: + +* `filter healthworker/h/1`: Filters a healthworker by the individual's name, phone, organisation or +specialisation. +* `filter request/r/2`: Filters a request by the patient's name, address, or the +date and time of the request and the status of the request + +Other enhancements made to Health Hub include: + +* `setreminder` command: Allows the user to set and register reminders in the + application. +* `undo/redo` command: Undo a previous action or redo a previously undone action. + +For more explicit information on the `filter`,`setreminder` and `undo/redo` +command, visit <>, under Filtering Health Workers/Requests. + +// tag::releasenotes-1.4[] +=== v1.4 Release Notes + +With the release of version 1.4, we decided to improve our current features by making them more dynamic and automated to reduce the manual work of changing the data. + +* The health worker field inside requests now shows the NRIC of the health worker instead of the name in previous versions. + +* Editing the NRIC of a health worker will dynamically change the health staff field of all requests assigned to the health worker. + +* Users can assign multiple requests to a health worker only if the requests are at least 2 hours apart. + +// end::releasenotes-1.4[] + +// tag::releasenotes-2.0[] +=== v2.0 Release Notes + +After the release of v1.4, the team have planned for future enhancements to Health Hub to improve its existing +functionalities, by also considering different aspects such as the ethical part of handling sensitive patient information within and outside of the app. + +For *data management*, it will be upgraded to an even higher level of encryption by professional standards to ensure that sensitive +information is handled cautiously to prevent data leaks. + +For *account management*, hospital administrative staff will have to start logging in to their accounts (accounts which are given to them when they +first joined the department) in order to use the app. These accounts are created and managed by a higher authority personnel, to add a +second layer of security. + +So far, with the releases of v1.2 to v1.4, the focus is on registering the requests into the system and assigning them. In v2.0, there will be additional details +added to health workers such as their *availability to visit the home care patients*, that will add value to when the user is assigning an open request. + +Last but not least, it is important that we gather our users' feedback from time to time to understand their frustrations and needs with the app. As such, +there will be a *"Feedback"* option in v2.0 for users to submit their feedback to the developers of Health Hub. +// end::releasenotes-2.0[] [[Features]] == Features +The following description of the features and commands are prototypes and specific details and implementation may vary over the course of the project. + +*General Command Format*: + +* Words in `` are the parameters to be supplied by the user e.g. in `add n/`, `` is a parameter which can be used as `add n/John Doe`. +* Items in square brackets are optional e.g `n/ [c/]` +can be used as `n/John Doe c/Claustrophobia` or as `n/John Doe`. +* Items with `…`​ after them can be used multiple times including zero times e.g. `s/...` can be used as `{nbsp}` (i.e. 0 times), `t/friend`, `t/friend t/family` etc. +* Parameters can be in any order e.g. if the command specifies `n/ p/`, `p/ n/` is also acceptable. + +[NOTE] +Our application does not support command chaining. Inputting multiple commands onto the same line will result in only the first command to be executed. +For example, calling `list r undo` will only list the requests and not execute the `undo` command. + +=== Viewing Help : `help` + +Upon first starting the application as a new user, or perhaps a returning +user, you may open up the help menu using the `help` command. + +Upon entering the `help` command, the help menu renders separately from the +Health Hub main application. Therefore, you do not have to worry about losing +any existing work on Health Hub when you are viewing the help menu! + +Format: `help` + +The help menu displays a list of available commands for Health Hub, their +parameters and their functions. Should you ever forget the commands for +Health Hub, feel free to enter the `help` command to revisit this guide. + + +// tag::listHealthWorker[] +=== Showing all requests/health workers : `list` + +The `list` command is a simple and basic command that on entering, displays +all health workers/requests in the Health Hub GUI. + +Format: `list ` + + +==== Showing all health workers + +Format: `list healthworker` + +*Shortcut(s)*: + +- `list h` + +- `list 1` + +Upon entering the command to list health workers, all currently registered +health workers in the Health Hub system will be displayed on the list on the +right side of the GUI. +// end::listHealthWorker[] + +==== Showing all requests + +Format: `list request` + +Shortcut(s): + +- `list r` + +- `list 2` + +After entering the command to list requests, you should see the list on the +left side of the GUI being populated with all requests that are added to +HealthHub. + +[TIP] ==== -*Command Format* +This command may be useful for users to identify existing personnel, +patients or requests in the system before assigning and closing existing +requests for specific health services. +==== + +Example: + +* `list healthworker` lists all health workers stored in the system, +their personal particulars, and their skills in the healthcare field. +* `list request` lists all requests stored in the system, as well as the +details of the request such as the patient to tend to, the date and time of +the request and the type of service requested. + +// tag::addHealthWorker[] +=== Adding requests/health workers: `add` + +Before you can jump right into the core feature of our application and +streamline the process of adding requests from patients and to assign +requests to experts in the medical field, it is essential to first ensure +that the respective health staff and patients are registered in the system +with all the key information. + +Add a request, health worker or patient to the application based on the +`` parameter accepted, using the `add` command, to register new health +staff, patients and requests. + + +Format: `add ...` + + +==== *Adding a health worker* + +*Format:* + +* `add healthworker n/ i/ n/ +o/ s/...` + +*Shortcuts:* + +* `add h n/ i/ n/ +o/ s/...` + +* `add 1 n/ i/ n/ o/ +s/...` + +Command that registers a new Health Worker person to the current roster. +Health Workers comprises of personnel who are authorized to work in sectors in the +healthcare industry in accordance to their `specialisation`. + +Health Workers authorized for medical practice specific to their +`specialisation` include doctors, nurses and community health workers that +are officially certified by certain medical practices. + +Each of the following fields entered by the user following +each prefix are compulsory, and must adhere to the following format: + +* ``: Name must only contain alphanumeric characters and spaces +, and cannot be empty. E.g Dog Terr +* ``: NRIC must start with S, T, G or F capitalized, followed by 7 +numeric characters and a capitalized alphabetical character. E.g S1234567A +* ``: Phone number must only contain 8 numeric characters, and + start with a 6, 8 or 9. +* ``: Organisation that the health worker belongs to. +Organisation name must have at least 2 characters, and only contain +alphanumeric characters. +* ``: Specialisation in the medical field that the health +worker possesses. The list of valid specialisations are as follows: + +** GENERAL_PRACTICE +** CARDIOLOGY +** ENDOCRINOLOGY +** NEUROLOGY +** ORTHOPAEDIC +** PAEDIATRIC +** GYNAECOLOGY +** UROLOGY +** PATHOLOGY +** HAEMATOLOGY +** PHYSIOTHERAPY +** OCCUPATIONAL_THERAPY +** ANAESTHESIOLOGY -* Words in `UPPER_CASE` are the parameters to be supplied by the user e.g. in `add n/NAME`, `NAME` is a parameter which can be used as `add n/John Doe`. -* Items in square brackets are optional e.g `n/NAME [t/TAG]` can be used as `n/John Doe t/friend` or as `n/John Doe`. -* Items with `…`​ after them can be used multiple times including zero times e.g. `[t/TAG]...` can be used as `{nbsp}` (i.e. 0 times), `t/friend`, `t/friend t/family` etc. -* Parameters can be in any order e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable. +[NOTE] +==== +The NRIC field provided uniquely identifies the health worker. When entering +the commands to add or edit a health worker, if the NRIC field matches an +already existing health worker with the same NRIC field, an error message +denoting a duplicate worker will be displayed. ==== -=== Viewing help : `help` +// end::addHealthWorker[] -Format: `help` +==== *Adding a request* + +*Format:* -=== Adding a person: `add` +* `add request n/ a/
i/ p/ dt/ c/...` -Adds a person to the address book + -Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` +*Shortcuts:* + +* `add r n/ a/
i/ p/ dt/ c/...` +* `add 2 n/ a/
i/ p/ dt/ c/...` + +* Registers a new open request from `patient` of `` into the +application. +* Each request also states the `` that the patient is +experiencing. Administrative staff can then inspect the conditions that are +stated by the `patient` and assign the appropriate health worker to handle +these requests in the `assign` command. +* Format for the time is `HH:mm:ss`, where HH represents the hours in a 24hr clock. +* Format for the date is `dd-MM-yyyy`. +* Multiple conditions can be accepted. However, each condition has to be prepended with `c/` tag. +* Two requests are considered duplicates if they have the same patient NRIC, date, address *and* conditions. Adding duplicate requests are not allowed. [TIP] -A person can have any number of tags (including 0) +The arguments and their respective tags can also be reordered. Examples: -* `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` -* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 t/criminal` -=== Listing all persons : `list` +* `add request n/Pay Shun i/S9123456G a/NUS UTown p/91234567 c/Heart Attack dt/30-01-2019 10:00:00` +* `add request n/Jin Livingston i/S9123456G a/NUS UTown p/91234567 c/Heart Attack dt/30-01-2019 10:00:00 c/Physiotherapy` + +[NOTE] +==== +If multiple prefixes are provided with valid values for parameters that can + only take in a single value, only the value of the last prefix will be + accepted. + E.g n/John n/Johnson the name field will be set to Johnson and + not John. + +Similarly for the `edit` command, in the case with multiple parameters with + the same prefix, only the last parameter value will be accepted as the new + value for that field. +==== + +=== Editing requests/health workers : `edit` + +Sometimes, information on a request of health staff may be keyed in wrongly +into the application, or you may need to update existing outdated information. + +To do this, you can replace the current information +with the new one using the `edit` command to modify existing personnel +records or request descriptions in Health Hub. -Shows a list of all persons in the address book. + -Format: `list` +The `edit` may come in handy when there is a need update to a request's +status, patient's condition or a health worker's skills, based on the +`` parameter accepted. + -=== Editing a person : `edit` +The prefixes and valid values for the `edit` command for both health worker +and request modes follow the same format as in the `add` command. + +==== *Editing a health worker* + +*Format:* + +* `edit healthworker ...` + +*Shortcuts:* + +* `edit h ...` +* `edit 1 ...` + +Edits the details of an existing health worker registered in Health Hub, at +the `` specified in the health worker list upon entering the `edit healthworker/h/1` command with valid inputs. + +[NOTE] +==== +* When editing specialisations for health workers, the existing specialisations + of the person will be removed i.e adding of specialisation is not cumulative. + +* Each health worker must have at least one specialisation. Entering an empty + value for `s/` prefix would result in the original health worker's `skills` + being kept. +==== + +[TIP] +==== +You can remove all the person's specialisation by typing `s/` without +specifying any parameters after it. +==== + +* `edit healthworker 1 p/91234567 n/John Doe` + +Edits the phone number and name of the 1st health worker shown in the health +worker list to be `91234567` and `John Doe` respectively. + + +// end::editHealthWorker[] + + +==== *Editing a request* + +*Format:* + +* `edit request ...` + +E.g `edit request 1 n/NAME p/PHONE a/ADDRESS i/NRIC c/CONDITION dt/DATE_TIME st/STATUS` + +*Shortcuts:* + +* `edit r ...` +* `edit 2 ...` + +Edits the details of a request registered in Health Hub, at +the `` specified in the request list upon entering the `edit +request` command with valid inputs. + +Upon entering the `edit` command with all the necessary and valid parameters, +the corresponding request/health worker at the specified ``. The index refers to the +index number shown in the displayed person list. + +Existing values of the request will be updated to the valid +input values based on the prefix specified. + +Any changes made to existing fields in requests are +immediately reflected in the list shown on the HealthHub GUI. + +{nbsp} + +*Notes*: + +* The index *must be a positive integer* 1, 2, 3, ... +and not greater than the number of requests/health workers/patients in the current list. + +* Apart from `specialisations` in health workers and `condition` in +patients, each field can only have a single value and multiple edit values +for other fields will only cause the last one to be accepted. + +* Note that the healthworker cannot be edited using this command. To unassign an existing healthworker, `edit` the status to `PENDING`. +To change the healthworker assigned, use the `assign` command instead. + +* When a request status is changed to pending, any assigned healthworker will be disassigned. + +* When changing the request status, there are only 3 valid statuses: PENDING, COMPLETED and ONGOING. Only these statuses will be accepted, and is not case-sensitive. + +* Not all the tags need to be specified. + +* The tags can be reordered. e.g `edit r 1 n/NAME p/91234567` is the same as `edit r 1 p/91234567 n/NAME` + +* Two requests are considered duplicates if they have the same patient NRIC, date, address *and* conditions. Duplicate requests are not allowed. + +[WARNING] +When editing the date of a request, ensure that the date entered is correct. HealthHub accepts any valid calendar dates in the format dd-mm-yyyy HH:mm:ss (where HH represents the time in 24hr format). -Edits an existing person in the address book. + -Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]...` -**** -* Edits 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, ... -* 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 specifying any tags after it. -**** Examples: -* `edit 1 p/91234567 e/johndoe@example.com` + -Edits the phone number and email address of the 1st person to be `91234567` and `johndoe@example.com` respectively. -* `edit 2 n/Betsy Crower t/` + -Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags. +* `edit request 2 n/Betsy Crower` + +* `edit r 2 n/Betsy Crower` + +* `edit 2 2 n/Betsy Crower` + +All the 3 commands above edits the patient name of the 2nd request in the request list to be `Betsy +Crower`. + +* `edit r 1 n/NAME p/PHONE a/ADDRESS i/NRIC c/CONDITION dt/DATE_TIME st/STATUS` + +// tag::filterHealthWorker[] +=== Filtering health workers/requests: `filter` + +When identifying health workers to assign to an open request, or +to look for a particular patient details in certain requests, it may be useful + to only display items in a list that match a particular constraint. + +Using the `filter` command, you can set the GUI to display health workers and +requests whose fields match the `keywords`that are specified in the `filter` +command, allowing you to find the doctors who are experts in cardiology much quicker. + + +Format: `filter []...` + + +==== *Filter health workers*: + +*Format:* -=== Locating persons by name: `find` +* `filter healthworker []` -Finds persons whose names contain any of the given keywords. + -Format: `find KEYWORD [MORE_KEYWORDS]` +*Shortcuts:* -**** -* 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. -* Only full words will be matched e.g. `Han` will not match `Hans` -* Persons matching at least one keyword will be returned (i.e. `OR` search). e.g. `Hans Bo` will return `Hans Gruber`, `Bo Yang` -**** +* `filter h []` +* `filter 1 []` + +Upon entering the command with valid inputs, HealthHub searches the entire list + of health +workers in Health Hub, and only displays the health workers whose fields +contains the parameters specified in the +`filter` command as a substring. + +// tag::filterExample[] +[TIP] +==== +* Multiple conditions for filtering health workers can be added +simultaneously for more expressive search. Note that if multiple parameters +are specified, HealthHub displays healthworkers that match *all* +the criteria mentioned. + +* To revert the view back to the original health worker list, enter the + `list healthworker` command. +==== Examples: -* `find John` + -Returns `john` and `John Doe` -* `find Betsy Tim John` + -Returns any person having names `Betsy`, `Tim`, or `John` +* `filter h s/GENERAL_PRACTICE s/GYNAECOLOGY` + +Returns all health workers whose field of expertise include general practice +*and* gynaecology. +// end::filterExample[] -=== Deleting a person : `delete` +[NOTE] +==== +For specialisation fields, parameter values need not follow the exact format as +the valid specialisation values provided under the `add` command section. +Valid parameters may include case insensitive substrings (E.g 'physio' will +match to 'PHYSIOTHERAPY'. +==== -Deletes the specified person from the address book. + -Format: `delete INDEX` +For example, to display only health workers who specialise in physiotherapy, +the `filter h s/physio` command can entered, using the shortcut `h` for +health worker mode and the substring `physio` instead for brevity, as shown +in the image below, in the Before section: -**** -* Deletes 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, ... -**** +image::filter_healthworker_UG.png[] + +When the command is keyed into the application, HealthHub will display the +state shown by the After section on the right side on the image above. The +command terminal displays a message denoting how many health workers are +found that has `PHYSIOTHERAPY` as a specialisation, and the health worker +list on the right side of the GUI displays only health workers who has +expertise in physiotherapy. + +// end::filterHealthWorker[] +==== *Filter requests*: + +Format: `filter request []` + +Shortcut(s): + +1. `filter r []` + +2. `filter 2 []` + +where `[ p/` +filters the request list for requests whose patient's name contains the +specified name substring *and* the specified phone number. +==== + +[TIP] +==== +To revert the view back to the original request list, enter the `list request` command. +==== Examples: -* `list` + -`delete 2` + -Deletes the 2nd person in the address book. -* `find Betsy` + -`delete 1` + -Deletes the 1st person in the results of the `find` command. +* `filter request n/alice` + +Returns all patients whose name contains "alice". +* `filter r p/9177` + +Returns all requests with contacts numbers that have "9177" in it's field. +* `filter 2 dt/30-01-2019 10:00:00` + +Returns all requests scheduled on 30th Jan 2019, at 10 am sharp. + +// tag::delHealthWorker[] +=== Deleting requests/health workers : `delete` + +Should there be any invalid or expired request, health worker or patient in +the application, you may also remove them to prevent cluttering of +unnecessary data by using the `delete` command to remove them from the +application based on the`` parameter accepted, according to the +index of the respective `type` +shown using the `list` command, or the index displayed on the GUI. + + +Format: `delete ` + + +==== *Delete a health worker*: + +*Format:* + +* `delete healthworker ` -=== Selecting a person : `select` +*Shortcuts:* -Selects the person identified by the index number used in the displayed person list. + -Format: `select INDEX` +* `delete h ` +* `delete 1 ` -**** -* Selects the person and loads the Google search page 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, ...` -**** +Deletes the health worker at the `` position in shown in the health +worker list. +// end::delHealthWorker[] + +==== *Delete a request*: + +*Format:* + +* `delete request ` + +*Shortcuts:* + +* `delete r ` +* `delete 2 ` + +Deletes the request at the `` position in shown in the list of requests. + +*Notes*: + +* Deletes the corresponding request/health worker/patient at the specified ``. +* The index refers to the index number shown in the displayed request/health +worker/patient list using the `list` command, or displayed through the GUI. +* The index *must be a positive integer* 1, 2, 3, ... and not greater +than the number of requests/health workers/patients in the current list. Examples: -* `list` + -`select 2` + -Selects the 2nd person in the address book. -* `find Betsy` + -`select 1` + -Selects the 1st person in the results of the `find` command. +* `delete healthworker 2` + +Deletes the 2nd health worker registered in the list of healthworkers in +Health Hub. -=== Listing entered commands : `history` +* `delete request 1` + +Deletes the 1st request as shown in the list of requests on the GUI of the +application + +[TIP] +==== +Accidentally deleted the wrong health worker or request? Don't worry, the +deletion can be undone using the `undo` command as long as the application is + still running. + +To undo the most recent `delete` command entered by entering the `undo` +command immediately after the previous `delete` command to undo the deletion. +==== + +=== Assigning requests to a health worker : `assign` + +After registering a new request using the `add request` command, you may +proceed to assign an existing health worker in the system to handle the request, + allocating medical resources to it and closing the request using the simple + `assign` command + + +Format: `assign hw/ r/...` + +Where the `` and `` are as shown in the +respective health worker and requests lists in the Health Hub GUI. + +*Notes*: + +* The `request_index` and `health_worker_index` fields *must be a positive integer* 1, 2, 3, ... and not greater +than the number of requests/health workers in the current list. +* The prefix `r/` has to be prepended to all requests indices that you would like to assign. +* Health worker that is assigned must be available at the current time stated by the request. + +Examples: + +* `assign r/1 hw/2` + +Assigns the health worker at the second index to the first request in the +request list. + +* `assign r/1 r/2 hw/2` + +Assigns the requests at the first and second request on the request list to the 2nd health worker in the healthworker list. -Lists all the commands that you have entered in reverse chronological order. + -Format: `history` [NOTE] ==== -Pressing the kbd:[↑] and kbd:[↓] arrows will display the previous and next input respectively in the command box. +* Healthworkers cannot be assigned to a completed request. To assign a healthworker to a request that is already completed, +use `edit` to change the status of the request to pending first. + +* You can reorder the parameters of the request and the healthworker. For example, executing `assign r/1 hw/2` has the same as +executing `assign hw/2 r/1` + +* Requests have to be at least 2 hours apart. i.e Healthworkers cannot be assigned to 2 requests that are less than 2 hours apart. +==== + +=== Clearing Requests : `clr` + +After closing all existing requests, you also have the option of clearing all + requests from the request list, regardless of the state of the request, upon + entering the `clr` command. + +Format: `clr` + +[WARNING] ==== +Clearing requests would delete all records of completed and pending requests. + +If you would like to delete just one particular request, consider using the +`delete` command instead. +==== + +=== Closing Requests : `complete` + +After an assigned task has been completed by the assigned health staff, who +has administered the necessary medical treatment, you can mark the request as + closed, using the `complete` command. + +Format: `complete ` + +Upon entering the `complete` command, you should notice the status of the +request at position `` changed to `COMPLETED`, marking the +request closed. + +*Notes*: + +* The `request_index` *must be a positive integer* 1, 2, 3, ... and not greater +than the number of requests in the current list. +* The `complete` command can only be used on *ongoing* requests. To complete a pending request, use the `edit` command to change the status of the request. + +Examples: + +* `complete 1` + +Marks the first request in the list as completed. // tag::undoredo[] -=== Undoing previous command : `undo` +=== Undoing Commands : `undo` +If you wish to undo a mistake that you had made while entering commands, +you can restore the lists to the state before the command was called using the `undo` command. -Restores the address book to the state before the previous _undoable_ command was executed. + Format: `undo` [NOTE] ==== -Undoable commands: those commands that modify the address book's content (`add`, `delete`, `edit` and `clear`). +* The `undo` command can only be used to undo commands that modify the lists such as `add`, `delete` and `edit`. +* For commands that affects the display such as `filter`, you can use `list` command to get back the original list. ==== -Examples: +=== Redoing undone commands : `redo` +If you wish to redo a command that you have previously undone, you can use the `redo` command. -* `delete 1` + -`list` + -`undo` (reverses the `delete 1` command) + +Format: `redo` -* `select 1` + -`list` + -`undo` + -The `undo` command fails as there are no undoable commands executed previously. -* `delete 1` + -`clear` + -`undo` (reverses the `clear` command) + -`undo` (reverses the `delete 1` command) + +// end::undoredo[] +=== Listing previous commands : `history` -=== Redoing the previously undone command : `redo` +In the case where you have been using the application for a while now, and +wish to track and see the past commands that you have entered into the +application, or where you have taken over the application from another +person, you can do so using the `history` command. + -Reverses the most recent `undo` command. + -Format: `redo` +Using the `history` command, you can view the previous commands entered in +the application in chronological order, allowing you to identify the order in + which commands are keyed in previously. -Examples: +Format: `history` + -* `delete 1` + -`undo` (reverses the `delete 1` command) + -`redo` (reapplies the `delete 1` command) + +[NOTE] +==== +Pressing the kbd:[↑] and kbd:[↓] arrows will display the previous and next input respectively in the command box. +==== -* `delete 1` + -`redo` + -The `redo` command fails as there are no `undo` commands executed previously. -* `delete 1` + -`clear` + -`undo` (reverses the `clear` command) + -`undo` (reverses the `delete 1` command) + -`redo` (reapplies the `delete 1` command) + -`redo` (reapplies the `clear` command) + -// end::undoredo[] +=== Viewing a request : `select` + +With the flexibility in managing and adding, editing and deleting requests, +existing functionality for the user to view the details of requests in +Health Hub has also been implemented to improve the user experience. + +Format: `select ` + +Shortcut: `sr ` + +Entering the `select` command allows the application to select the request at the + specified ``, and displays the full details of the selected + request on the GUI. -=== Clearing all entries : `clear` +[TIP] +==== +Users also have the option of clicking on a request in the request list on +the GUI, which automatically selects the clicked request as the displayed +request. +==== + +// tag::setreminder[] +=== Setting Reminder Alerts: `setreminder` + +Sometimes when you have too many tasks at hand, it can be quite cumbersome to remember what tasks you need to +complete for the day. You might want to phone up a patient to remind him of an appointment before the health worker +visits his home, because you recall that this patient was not at home the last time the health worker visited. The +phone call from you can prepare him to be at his home when the health worker arrives, so he can provide the necessary +health care services. It can also remind you when it is lunch time, so you can avoid the peak period! -Clears all entries from the address book. + -Format: `clear` +Format: `setreminder t/ m/` + + +Using the `setreminder` command, you can set a reminder alert to notify you at a certain time of the day, with your +own message that you can customise to remind yourself. + +[NOTE] +==== +The alert only shows for when Health Hub is running in the background process. +==== + +In the example below, a reminder has been set to notify the user at 6.30PM with +the customised message to "to call patient Tan Ah Hock for his appointment later at night". + +image::SetReminderCommandTextField.png[] +Figure 5.14.1 shows the format of the `setreminder` command in the text field. + +image::SetReminderResult.png[] +Figure 5.14.2 shows the result of the reminder alert in the GUI after it is time for the app to notify the user. +// end::setreminder[] + +// tag::statistics[] +=== Getting health condition statistics: `statistics` + +We understand that it is imperative for you to know which health conditions have been seeing an increasing trend, as +well as take note of those which have been experiencing a decline. The `statistics` command allows you to view all +health conditions that have been registered on HealthHub, and also their respective numbers of occurrences. + +Format: `statistics` -> this command displays a list of all health conditions that you have typed into HealthHub, and +shows each health condition’s related number of occurrences. + +[NOTE] +==== +`statistics` will only show any useful information related to frequency of health conditions after you have added at least +1 request for homecare on HealthHub. If there are no homecare requests made, the statistics panel will display the +following: +==== + +image::empty_statistics.PNG[] + +Example of usage: + +Let’s say that no commands have been issued yet and HealthHub is on a clean slate with no prior records of requests. +Suppose as an administrative staff, you input the following commands as your first 2 requests for home care into +HealthHub: + +`add request n/John Doe i/S8974421C p/98765432 a/123 Brick Road, #01-01 dt/01-01-2019 14:50:00 c/Diabetes +c/Physiotherapy` + +`add request n/Dohn Joe i/S9874421C p/98675432 a/Sheares Hall, #01-01 dt/06-05-2019 10:10:00 c/AIDS c/Physiotherapy` + +You can then subsequently type in the following command: + +`statistics` + +Voila! A list of health conditions (namely, the ones which were typed in the 2 abovementioned requests Physiotherapy, +Diabetes, AIDS) will be generated and will be displayed in descending order of occurrences. The following screen is what +you can expect to see after typing in the 3 commands. + +image::normal_statistics.PNG[] + +==== Updating of statistics + +Every time you decide to add a request, edit a request, delete a request or even undo and redo a request, it is +important that the statistics display automatically keeps updating itself so that real-time accurate data is always +showed whenever you type in `statistics` + +Example of usage: + +Let’s assume you still have the requests of John Doe and Dohn Joe (requests that you had placed into HealthHub from the +previous section) in the request panel. You just received news that John Doe’s mobility has miraculously improved and +you no longer need to tag him with the ‘Physiotherapy’ health condition in his health request record. You, thus, decided +to edit John Doe’s health conditions from Diabetes and Physiotherapy to just Diabetes by issuing the following command: + +`edit r 1 c/Diabetes` + +image::statistics_before_edit.PNG[] + +You can then subsequently type in the following command to gather accurate statistical data, +which reflects the deletion of one of the ‘Physiotherapy’ health conditions: + +`statistics` + +image::statistics_after_edit.PNG[] + +After issuing the aforementioned commands, you now receive news that John Doe had not really recovered entirely yet, +and he still requires Physiotherapy treatment. Fret not! You can always issue the `undo` command to revert your changes to +John’s earlier set of health conditions (Physiotherapy and Diabetes) and then the `statistics` command to view the new +data. + +In essence, the `statistics` command is fully integrated with all request-related commands (`add`, `edit`, `delete`, +`undo`, `redo`, `clr`) in its pursuit of always providing accurate, real-time statistical information. + +==== Application of `statistics` in the workplace + +Upon collating such data, you can feedback and make suggestions to the hospital to increase or decrease training in +certain departments. Furthermore, you can even use this data as a basis for the health sector to ramp up efforts in its +Work Skills Qualification certification for certain healthcare skills to be taught to new aspiring healthcare +professionals. + +// end::statistics[] === Exiting the program : `exit` -Exits the program. + +Once you are done using the application, you can exit the application by +entering the `exit` command, hereby saving any information at the current +point in time before shutting down. + + Format: `exit` === Saving the data -Address book data are saved in the hard disk automatically after any command that changes the data. + -There is no need to save manually. +All application data are saved in the hard disk automatically after exiting +the application, removing the need to save manually. + -// tag::dataencryption[] -=== Encrypting data files `[coming in v2.0]` +Changes to the data in the application are also saved that any command that +modifies application parameters, making sure that minimal data is lost should +any unforeseen circumstances happen. -_{explain how the user can enable/disable data encryption}_ -// end::dataencryption[] +Attempting to read a corrupted data file will show an empty book. +If the application is unable to find any data files, it will create books based on its sample data. == FAQ *Q*: How do I transfer my data to another Computer? + -*A*: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous Address Book folder. +*A*: Install the app in another computer, and transfer the data files `healthworkerbook.json` and `requestbook.json` +to the `\data` folder of the app directory. +// tag::summary[] == Command Summary -* *Add* `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` + -e.g. `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 t/friend t/colleague` -* *Clear* : `clear` -* *Delete* : `delete INDEX` + -e.g. `delete 3` -* *Edit* : `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]...` + -e.g. `edit 2 n/James Lee e/jameslee@example.com` -* *Find* : `find KEYWORD [MORE_KEYWORDS]` + -e.g. `find James Jake` -* *List* : `list` -* *Help* : `help` -* *Select* : `select INDEX` + -e.g.`select 2` -* *History* : `history` -* *Undo* : `undo` -* *Redo* : `redo` +[%header, cols=4*] +|=== +|Base Command +|Additional Parameters +|Description +|Remarks + +|`help` +|_not applicable_ +|opens the user guide in a new window +|_none_ +|`list healthworker/h/1` + + +`list request/r/2` +|_not applicable_ +|lists all the health workers or requests +|_none_ +|`add healthworker/h/1` +|`n/ (name)` - required + + `i/ (nric)` - required + + `p/ (phone)` - required + + `o/ (organisation)` - required + + `s/ (specialisations)` - required +|registers a health worker into the system +|_none_ +|`add request/r/2` +|`n/ (name)` - required + + `i/ (nric)` - required + + `p/ (phone)` - required + + `a/ (address)` - required + + `dt/ (request date)` - required + + `c/ (patient conditions)` - required +|registers a request into the system +|_none_ +|`edit` +|any of the tags above (i.e. edit `n/` or `dt/` or `c/`) +|edits the details of a request or a health worker +|_none_ +|`filter healthworker/h/1` +|any of the tags above belonging to health worker (i.e. filter by `n/` or `o/` or `s/`) +|filters through the list of health workers by a criteria +|_none_ +|`filter request/r/2` +|any of the tags above belonging to request (i.e. filter by `n/` or `dt/` or `c/`). + + +new filterable tag after request is added - `st/ (request status)` +|filters through the list of requests by a criteria +|_none_ +|`delete request` +|`INDEX` of request to delete +|deletes a request +|_none_ +|`assign` +|`hw/` - `INDEX` of the health worker to be assigned, required + + +`r/` - `INDEX` of the request, required +|assigns a health worker to an open request +|should a health worker be assigned to requests on the same date and time, it should be at least 2 hours apart. +|`complete` +|`INDEX` of the request to close +|closes an ongoing request after it has been completed by the assigned staff +|only used for requests that have the *ONGOING* status + +|`clr` +|_not applicable_ +|clears all *COMPLETED* requests from the list +|_none_ +|`history` +|_not applicable_ +|lists the previous commands entered in chronological order +|_none_ +|`sr` +|`INDEX` of request to display +|selects a request and display its details on the UI +|_none_ +|`setreminder` +|`t/` - time to schedule, required + + +`m/` - customised message, required +|sets a reminder alert to notify the user at a certain time of the day +|the alert will show only if Health Hub is still running +|`statistics` +|_not applicable_ +|shows the occurences of the different requests by conditions +|_none_ +|`undo` +|_not applicable_ +|undos the previous action +|_none_ +|`redo` +|_not applicable_ +|redos the previous undone command +|_none_ +|=== +// end::summary[] diff --git a/docs/diagrams/AddRequestCommandSequenceDiagram.pptx b/docs/diagrams/AddRequestCommandSequenceDiagram.pptx new file mode 100644 index 000000000000..81ef8b9854af Binary files /dev/null and b/docs/diagrams/AddRequestCommandSequenceDiagram.pptx differ diff --git a/docs/diagrams/FilterRequestCommand.pptx b/docs/diagrams/FilterRequestCommand.pptx new file mode 100644 index 000000000000..97984f1aadc2 Binary files /dev/null and b/docs/diagrams/FilterRequestCommand.pptx differ diff --git a/docs/diagrams/LogicComponentClassDiagram.pptx b/docs/diagrams/LogicComponentClassDiagram.pptx index 6fcc1136a5bb..d864ff7d3f1f 100644 Binary files a/docs/diagrams/LogicComponentClassDiagram.pptx and b/docs/diagrams/LogicComponentClassDiagram.pptx differ diff --git a/docs/diagrams/LogicComponentSequenceDiagram.pptx b/docs/diagrams/LogicComponentSequenceDiagram.pptx index 410277bbd866..c1c5d88e63ea 100644 Binary files a/docs/diagrams/LogicComponentSequenceDiagram.pptx and b/docs/diagrams/LogicComponentSequenceDiagram.pptx differ diff --git a/docs/diagrams/SetReminderCommandSequenceDiagram.pptx b/docs/diagrams/SetReminderCommandSequenceDiagram.pptx new file mode 100644 index 000000000000..dc362b5fe8c4 Binary files /dev/null and b/docs/diagrams/SetReminderCommandSequenceDiagram.pptx differ diff --git a/docs/diagrams/UiComponentClassDiagram.pptx b/docs/diagrams/UiComponentClassDiagram.pptx index ab325e889f70..e771f3a70a80 100644 Binary files a/docs/diagrams/UiComponentClassDiagram.pptx and b/docs/diagrams/UiComponentClassDiagram.pptx differ diff --git a/docs/images/AutoCompleteTextFieldSMD.png b/docs/images/AutoCompleteTextFieldSMD.png new file mode 100644 index 000000000000..f4058481c8e9 Binary files /dev/null and b/docs/images/AutoCompleteTextFieldSMD.png differ diff --git a/docs/images/FilterCommandParserLogicSD.png b/docs/images/FilterCommandParserLogicSD.png new file mode 100644 index 000000000000..feaf0bbae2bd Binary files /dev/null and b/docs/images/FilterCommandParserLogicSD.png differ diff --git a/docs/images/FilterHealthWorkerSD.png b/docs/images/FilterHealthWorkerSD.png new file mode 100644 index 000000000000..95c30c5212b5 Binary files /dev/null and b/docs/images/FilterHealthWorkerSD.png differ diff --git a/docs/images/HealthHub.png b/docs/images/HealthHub.png new file mode 100644 index 000000000000..ada019914161 Binary files /dev/null and b/docs/images/HealthHub.png differ diff --git a/docs/images/SetReminderCommandTextField.png b/docs/images/SetReminderCommandTextField.png new file mode 100644 index 000000000000..f4686ebb4b3c Binary files /dev/null and b/docs/images/SetReminderCommandTextField.png differ diff --git a/docs/images/SetReminderResult.png b/docs/images/SetReminderResult.png new file mode 100644 index 000000000000..f931c2f43d98 Binary files /dev/null and b/docs/images/SetReminderResult.png differ diff --git a/docs/images/SetReminderSequenceDiagram.png b/docs/images/SetReminderSequenceDiagram.png new file mode 100644 index 000000000000..0292d0dedca2 Binary files /dev/null and b/docs/images/SetReminderSequenceDiagram.png differ diff --git a/docs/images/StorageClassDiagram.png b/docs/images/StorageClassDiagram.png index e5527ecac459..be64f6ce8cb0 100644 Binary files a/docs/images/StorageClassDiagram.png and b/docs/images/StorageClassDiagram.png differ diff --git a/docs/images/Ui.png b/docs/images/Ui.png index 5ec9c527b49c..a78a47397b2a 100644 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/images/UiClassDiagram.png b/docs/images/UiClassDiagram.png index 5f3847621e07..c13ba46e3005 100644 Binary files a/docs/images/UiClassDiagram.png and b/docs/images/UiClassDiagram.png differ diff --git a/docs/images/Ui_home.png b/docs/images/Ui_home.png new file mode 100644 index 000000000000..ecac2302cbf1 Binary files /dev/null and b/docs/images/Ui_home.png differ diff --git a/docs/images/Ui_home_orange.png b/docs/images/Ui_home_orange.png new file mode 100644 index 000000000000..9458cd203212 Binary files /dev/null and b/docs/images/Ui_home_orange.png differ diff --git a/docs/images/UndoRedoActDiagram.png b/docs/images/UndoRedoActDiagram.png new file mode 100644 index 000000000000..ecd4770ee63a Binary files /dev/null and b/docs/images/UndoRedoActDiagram.png differ diff --git a/docs/images/UndoRedoActivityDiagram.png b/docs/images/UndoRedoActivityDiagram.png deleted file mode 100644 index 55e4138cc64f..000000000000 Binary files a/docs/images/UndoRedoActivityDiagram.png and /dev/null differ diff --git a/docs/images/UndoRedoSeqDiagram.png b/docs/images/UndoRedoSeqDiagram.png new file mode 100644 index 000000000000..37589432a4a5 Binary files /dev/null and b/docs/images/UndoRedoSeqDiagram.png differ diff --git a/docs/images/UndoRedoSequenceDiagram.png b/docs/images/UndoRedoSequenceDiagram.png deleted file mode 100644 index 5c9d5936f098..000000000000 Binary files a/docs/images/UndoRedoSequenceDiagram.png and /dev/null differ diff --git a/docs/images/addHwRequestDates.png b/docs/images/addHwRequestDates.png new file mode 100644 index 000000000000..490248f02e63 Binary files /dev/null and b/docs/images/addHwRequestDates.png differ diff --git a/docs/images/addrequest.png b/docs/images/addrequest.png new file mode 100644 index 000000000000..d564f430756e Binary files /dev/null and b/docs/images/addrequest.png differ diff --git a/docs/images/addrequestcommand.png b/docs/images/addrequestcommand.png new file mode 100644 index 000000000000..f64562b1eb50 Binary files /dev/null and b/docs/images/addrequestcommand.png differ diff --git a/docs/images/assignRegionCheck.png b/docs/images/assignRegionCheck.png new file mode 100644 index 000000000000..3a7c7c95421d Binary files /dev/null and b/docs/images/assignRegionCheck.png differ diff --git a/docs/images/assignReqToHw.png b/docs/images/assignReqToHw.png new file mode 100644 index 000000000000..c929b5653807 Binary files /dev/null and b/docs/images/assignReqToHw.png differ diff --git a/docs/images/assignreq.png b/docs/images/assignreq.png new file mode 100644 index 000000000000..d23ea5def09f Binary files /dev/null and b/docs/images/assignreq.png differ diff --git a/docs/images/assignreq1.png b/docs/images/assignreq1.png new file mode 100644 index 000000000000..288d1e4c6c92 Binary files /dev/null and b/docs/images/assignreq1.png differ diff --git a/docs/images/assignreq2.png b/docs/images/assignreq2.png new file mode 100644 index 000000000000..8a9a0c729682 Binary files /dev/null and b/docs/images/assignreq2.png differ diff --git a/docs/images/assignrequest.png b/docs/images/assignrequest.png new file mode 100644 index 000000000000..546ca9e9429d Binary files /dev/null and b/docs/images/assignrequest.png differ diff --git a/docs/images/assignrequest1.png b/docs/images/assignrequest1.png new file mode 100644 index 000000000000..41476fa3178a Binary files /dev/null and b/docs/images/assignrequest1.png differ diff --git a/docs/images/brohandev.png b/docs/images/brohandev.png new file mode 100644 index 000000000000..26f2d880ee4b Binary files /dev/null and b/docs/images/brohandev.png differ diff --git a/docs/images/checkConflictingRequests.png b/docs/images/checkConflictingRequests.png new file mode 100644 index 000000000000..cd06364dcc91 Binary files /dev/null and b/docs/images/checkConflictingRequests.png differ diff --git a/docs/images/damithc.jpg b/docs/images/damithc.jpg deleted file mode 100644 index 127543883893..000000000000 Binary files a/docs/images/damithc.jpg and /dev/null differ diff --git a/docs/images/daviddl9.png b/docs/images/daviddl9.png new file mode 100644 index 000000000000..44a748215cef Binary files /dev/null and b/docs/images/daviddl9.png differ diff --git a/docs/images/empty_statistics.PNG b/docs/images/empty_statistics.PNG new file mode 100644 index 000000000000..0b1d2d0169e9 Binary files /dev/null and b/docs/images/empty_statistics.PNG differ diff --git a/docs/images/filterResult.png b/docs/images/filterResult.png new file mode 100644 index 000000000000..862e436f813c Binary files /dev/null and b/docs/images/filterResult.png differ diff --git a/docs/images/filter_healthworker_UG.png b/docs/images/filter_healthworker_UG.png new file mode 100644 index 000000000000..3b9ecaddcef9 Binary files /dev/null and b/docs/images/filter_healthworker_UG.png differ diff --git a/docs/images/filterrequest.png b/docs/images/filterrequest.png new file mode 100644 index 000000000000..ea77361ca658 Binary files /dev/null and b/docs/images/filterrequest.png differ diff --git a/docs/images/filterrequestafter.png b/docs/images/filterrequestafter.png new file mode 100644 index 000000000000..a71c23b07dfa Binary files /dev/null and b/docs/images/filterrequestafter.png differ diff --git a/docs/images/filterrequestbefore.png b/docs/images/filterrequestbefore.png new file mode 100644 index 000000000000..56668cf3fa43 Binary files /dev/null and b/docs/images/filterrequestbefore.png differ diff --git a/docs/images/filterrequestcommand.png b/docs/images/filterrequestcommand.png new file mode 100644 index 000000000000..1a7798b8e90a Binary files /dev/null and b/docs/images/filterrequestcommand.png differ diff --git a/docs/images/hbafteradd.png b/docs/images/hbafteradd.png new file mode 100644 index 000000000000..320b40d77cca Binary files /dev/null and b/docs/images/hbafteradd.png differ diff --git a/docs/images/hbafterclear.png b/docs/images/hbafterclear.png new file mode 100644 index 000000000000..e68ca4051ab5 Binary files /dev/null and b/docs/images/hbafterclear.png differ diff --git a/docs/images/hbafterdel.png b/docs/images/hbafterdel.png new file mode 100644 index 000000000000..5daaebf5e202 Binary files /dev/null and b/docs/images/hbafterdel.png differ diff --git a/docs/images/hbafterundo.png b/docs/images/hbafterundo.png new file mode 100644 index 000000000000..c036007c530c Binary files /dev/null and b/docs/images/hbafterundo.png differ diff --git a/docs/images/hbstate1.png b/docs/images/hbstate1.png new file mode 100644 index 000000000000..efea580223c6 Binary files /dev/null and b/docs/images/hbstate1.png differ diff --git a/docs/images/huichun66.png b/docs/images/huichun66.png new file mode 100644 index 000000000000..e9712b0a4ba0 Binary files /dev/null and b/docs/images/huichun66.png differ diff --git a/docs/images/inithb.png b/docs/images/inithb.png new file mode 100644 index 000000000000..31880458609b Binary files /dev/null and b/docs/images/inithb.png differ diff --git a/docs/images/initmodifycommandhistory.png b/docs/images/initmodifycommandhistory.png new file mode 100644 index 000000000000..9d28c7800d93 Binary files /dev/null and b/docs/images/initmodifycommandhistory.png differ diff --git a/docs/images/initrb.png b/docs/images/initrb.png new file mode 100644 index 000000000000..d9998c28b29d Binary files /dev/null and b/docs/images/initrb.png differ diff --git a/docs/images/jing1324.png b/docs/images/jing1324.png new file mode 100644 index 000000000000..1468571aca17 Binary files /dev/null and b/docs/images/jing1324.png differ diff --git a/docs/images/lejolly.jpg b/docs/images/lejolly.jpg deleted file mode 100644 index 2d1d94e0cf5d..000000000000 Binary files a/docs/images/lejolly.jpg and /dev/null differ diff --git a/docs/images/logicclassdiag.png b/docs/images/logicclassdiag.png new file mode 100644 index 000000000000..667bb0747bd5 Binary files /dev/null and b/docs/images/logicclassdiag.png differ diff --git a/docs/images/logicseqdiagram.png b/docs/images/logicseqdiagram.png new file mode 100644 index 000000000000..0bc4c006c00a Binary files /dev/null and b/docs/images/logicseqdiagram.png differ diff --git a/docs/images/lookuz.png b/docs/images/lookuz.png new file mode 100644 index 000000000000..494871f5bdfb Binary files /dev/null and b/docs/images/lookuz.png differ diff --git a/docs/images/m133225.jpg b/docs/images/m133225.jpg deleted file mode 100644 index fd14fb94593a..000000000000 Binary files a/docs/images/m133225.jpg and /dev/null differ diff --git a/docs/images/mchafteradd.png b/docs/images/mchafteradd.png new file mode 100644 index 000000000000..be56f81ef1f5 Binary files /dev/null and b/docs/images/mchafteradd.png differ diff --git a/docs/images/mchafterdelete.png b/docs/images/mchafterdelete.png new file mode 100644 index 000000000000..204d26c725fa Binary files /dev/null and b/docs/images/mchafterdelete.png differ diff --git a/docs/images/mchafteroverride.png b/docs/images/mchafteroverride.png new file mode 100644 index 000000000000..084b88cf0ee5 Binary files /dev/null and b/docs/images/mchafteroverride.png differ diff --git a/docs/images/mchafterundo.png b/docs/images/mchafterundo.png new file mode 100644 index 000000000000..390dc03c3bef Binary files /dev/null and b/docs/images/mchafterundo.png differ diff --git a/docs/images/modelUmlDiagram.png b/docs/images/modelUmlDiagram.png new file mode 100644 index 000000000000..44db6fbea871 Binary files /dev/null and b/docs/images/modelUmlDiagram.png differ diff --git a/docs/images/normal_statistics.PNG b/docs/images/normal_statistics.PNG new file mode 100644 index 000000000000..d96ac28c9ae0 Binary files /dev/null and b/docs/images/normal_statistics.PNG differ diff --git a/docs/images/rbafterdelete.png b/docs/images/rbafterdelete.png new file mode 100644 index 000000000000..05c2f2654305 Binary files /dev/null and b/docs/images/rbafterdelete.png differ diff --git a/docs/images/rbafterlist.png b/docs/images/rbafterlist.png new file mode 100644 index 000000000000..02d7c0bb40e1 Binary files /dev/null and b/docs/images/rbafterlist.png differ diff --git a/docs/images/rbstate1.png b/docs/images/rbstate1.png new file mode 100644 index 000000000000..d8d05653c7a6 Binary files /dev/null and b/docs/images/rbstate1.png differ diff --git a/docs/images/reminder_command.png b/docs/images/reminder_command.png new file mode 100644 index 000000000000..72613a4baf50 Binary files /dev/null and b/docs/images/reminder_command.png differ diff --git a/docs/images/rohan_brief_overview.PNG b/docs/images/rohan_brief_overview.PNG new file mode 100644 index 000000000000..16de2694dcee Binary files /dev/null and b/docs/images/rohan_brief_overview.PNG differ diff --git a/docs/images/rohan_first_stats_display.PNG b/docs/images/rohan_first_stats_display.PNG new file mode 100644 index 000000000000..8c466004a806 Binary files /dev/null and b/docs/images/rohan_first_stats_display.PNG differ diff --git a/docs/images/rohan_patient_profile.PNG b/docs/images/rohan_patient_profile.PNG new file mode 100644 index 000000000000..40be3b1e343f Binary files /dev/null and b/docs/images/rohan_patient_profile.PNG differ diff --git a/docs/images/statistics_activity_diagram.png b/docs/images/statistics_activity_diagram.png new file mode 100644 index 000000000000..d3579a267ae0 Binary files /dev/null and b/docs/images/statistics_activity_diagram.png differ diff --git a/docs/images/statistics_after_edit.PNG b/docs/images/statistics_after_edit.PNG new file mode 100644 index 000000000000..41b6815352a7 Binary files /dev/null and b/docs/images/statistics_after_edit.PNG differ diff --git a/docs/images/statistics_before_edit.PNG b/docs/images/statistics_before_edit.PNG new file mode 100644 index 000000000000..f82f2a0736e6 Binary files /dev/null and b/docs/images/statistics_before_edit.PNG differ diff --git a/docs/images/statistics_command.png b/docs/images/statistics_command.png new file mode 100644 index 000000000000..f303d996b1a2 Binary files /dev/null and b/docs/images/statistics_command.png differ diff --git a/docs/images/statistics_command_desc.png b/docs/images/statistics_command_desc.png new file mode 100644 index 000000000000..d26c40b78b41 Binary files /dev/null and b/docs/images/statistics_command_desc.png differ diff --git a/docs/images/statistics_command_sequence.jpg b/docs/images/statistics_command_sequence.jpg new file mode 100644 index 000000000000..6ba60c62cf33 Binary files /dev/null and b/docs/images/statistics_command_sequence.jpg differ diff --git a/docs/images/statistics_command_sequence.png b/docs/images/statistics_command_sequence.png new file mode 100644 index 000000000000..edf9954d5900 Binary files /dev/null and b/docs/images/statistics_command_sequence.png differ diff --git a/docs/images/yijinl.jpg b/docs/images/yijinl.jpg deleted file mode 100644 index adbf62ad9406..000000000000 Binary files a/docs/images/yijinl.jpg and /dev/null differ diff --git a/docs/images/yl_coder.jpg b/docs/images/yl_coder.jpg deleted file mode 100644 index 17b48a732272..000000000000 Binary files a/docs/images/yl_coder.jpg and /dev/null differ diff --git a/docs/team/brohandev.adoc b/docs/team/brohandev.adoc new file mode 100644 index 000000000000..63d860fb3d7d --- /dev/null +++ b/docs/team/brohandev.adoc @@ -0,0 +1,320 @@ += Rohan Dev - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== Introduction + +Hello there! I am Rohan Dev, a Year 2 Computer Science undergraduate from the National University of Singapore (NUS). +This portfolio documents the contributions I have made to Project HealthHub over the course of an academic semester. +HealthHub has exposed me to making contributions to a pre-existing code base and morphing it into a desktop application +of our choice. I have picked up many relevant skills and software engineering principles en route to completing this +project. + +== HealthHub + +=== Problem needing to be solved + +With the number of elderly slated to reach 900,000 by 2030 resulting in an increasing need for Intermediate and +Long-Term Care (ILTC) services, it comes as no surprise that the amount of documentation for these patients is also +increasing rapidly. Furthermore, from our research, it had been brought to our attention that almost all records for +homecare patients are being done on pen and paper, resulting in slower assignment of homecare jobs to the health +professionals. The hospital administrative staff we spoke to even mentioned that the excessive paperwork contributes to +an excessive number of binders being used and a permanent state of chaos and clutter on their desks. My team and I saw +this as an opportunity to really come up with something relevant and helpful to the healthcare scene in Singapore and +thus, HealthHub was born. + +== Brief Overview of HealthHub + +image::rohan_brief_overview.PNG[] + +HealthHub is a robust desktop application designed to be a centralized platform for hospital administrative staff to +efficiently manage the assignment of health workers (doctors/nurses/volunteers with relevant certification) to homecare +patients and monitor their statuses at their respective jobs. The digitization of the homecare job assignment process +significantly reduces paperwork and allows for far more organization of information. + +HealthHub users interact through the Command Line Interface (CLI) and receive visual feedback through a User Interface +(UI) created with JavaFX. It is written in Java. The features and implementations are well documented in guides for +users and developers respectively. HealthHub has been well maintained with high code quality and coverage as it is +covered by rigorous tests and checks. + +=== My Role + +My role was to facilitate the computation and display of statistics related to the occurrences of all health conditions +on the HealthHub platform. Since the statistics feature needs to calculate each health condition’s frequency across all +users on HealthHub, I also constructed the base Java class for Condition, such that the administrator can type in a +patient’s health condition or homecare requirement (for e.g. ‘Cancer’, ‘Palliative’, ‘Physiotherapy’ and more) when +adding a request for homecare, and the statistics feature adds to its specific number of occurrences. In addition, I +wrote rigorous tests and test utilities to ensure reliability and simple maintenance. + +== Summary of contributions + +* *Major enhancement*: Adding the *ability to view the most common health conditions* amongst patients registered on HealthHub + +image::rohan_first_stats_display.PNG[] + +** *What it does*: allows the administrative staff to call for the frequencies of all health conditions registered on HealthHub. It can also call the frequency of a specific health condition in descending order. Calling the statistics command specific to a particular condition will likewise display the number of occurrences of that health condition. +** *Justification*: It is imperative for the health administrators to know which health conditions have been seeing an increasing trend, as well as take note of those which have been experiencing a decline. Upon collating such data, the administrative staff can feedback and make suggestions to the hospital to increase or decrease training in certain departments. The staff can even suggest to the government to ramp up efforts in its Work Skills Qualification certification for certain healthcare skills to be taught to new aspiring healthcare professionals. +** *Highlights*: The statistics feature needs to be able to ensure that the administrative staff can extract relevant information as fast as possible. Therefore, the TreeMap data structure was used to contain all occurrences of health conditions on HealthHub for the best overall performance for speed. I have had to overcome the difficulty of having to coordinate with all HealthHub commands and sync my statistical data with the data in the application. For example, when the `undo` command is made, my statistics data must also go back to the state prior to the `undo` call. + +* *Minor enhancement*: Incorporated a patient’s set of health conditions into requests for home care. + +image::rohan_patient_profile.PNG[] + +** *What it does*: When adding a request for home care in HealthHub, instead of merely typing in 1 health condition per request, the administrative staff can now add in a set of all health conditions the particular patient may suffer from. +** *Justification*: Health practitioners, before attempting treatment on any patient, would want to know all health conditions the particular patient might be suffering from. There have been plenty of cases in the past where the administered treatment by the health care professional on a patient had triggered other health conditions in the patient, which the healthcare professionals were completely unaware of. Therefore, instead of just adding a request for a particular treatment, administrators can add a request with multiple health conditions. +** *Highlights*: When the administrator adds a request for home care on the HealthHub platform, it takes in all the patient’s particulars (name, NRIC, phone number, home address) and a set of health conditions the patient suffers from. I made use of the hashset data structure to contain the set of health conditions inside it for each patient. The set of conditions guarantees no duplicate health condition being found inside and it can also speedily access any specific health condition the administrative staff may be looking for or may be interested in for further investigation. + +* *Other contributions*: + +** Project management: +*** Setup codacy and coveralls badges for the team on GitHub +** Enhancements to existing features: +*** Wrote Conditions class based off Tag class from Address Book 4, and incorporated additional functionality for it to accept more than just 1 string input. +*** Wrote tests for Condition class and condition-related features in Request class, including various test utility classes to assist other team members in their testing +** Documentation: +*** Added detailed implementation documentation for the statistics feature in the User Guide and the Developer Guide, including diagrams +** Community: +*** Reviewed and gave feedback to team members. PRs reviewed: https://github.com/CS2103-AY1819S2-W09-2/main/pull/80[#80], https://github.com/CS2103-AY1819S2-W09-2/main/pull/107[#107], https://github.com/CS2103-AY1819S2-W09-2/main/pull/142[#142] +** Tools: +*** Setup Codacy and Coveralls badges to perform automated testing of test cases and auto-publishing of documentation and reports on overall overage score of the application software. + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +=== Getting health condition statistics: `statistics` + +We understand that it is imperative for you to know which health conditions have been seeing an increasing trend, as +well as take note of those which have been experiencing a decline. The `statistics` command allows you to view all +health conditions that have been registered on HealthHub, and also their respective numbers of occurrences. + +Format: `statistics` -> this command displays a list of all health conditions that you have typed into HealthHub, and +shows each health condition’s related number of occurrences. + +[NOTE] +==== +`statistics` will only show any useful information related to frequency of health conditions after you have added at least +1 request for homecare on HealthHub. If there are no homecare requests made, the statistics panel will display the +following: +==== + +image::empty_statistics.PNG[] + +Example of usage: + +Let’s say that no commands have been issued yet and HealthHub is on a clean slate with no prior records of requests. +Suppose as an administrative staff, you input the following commands as your first 2 requests for home care into +HealthHub: + +`add request n/John Doe i/S8974421C p/98765432 a/123 Brick Road, #01-01 dt/01-01-2019 14:50:00 c/Diabetes +c/Physiotherapy` + +`add request n/Dohn Joe i/S9874421C p/98675432 a/Sheares Hall, #01-01 dt/06-05-2019 10:10:00 c/AIDS c/Physiotherapy` + +You can then subsequently type in the following command: + +`statistics` + +Voila! A list of health conditions (namely, the ones which were typed in the 2 abovementioned requests Physiotherapy, +Diabetes, AIDS) will be generated and will be displayed in descending order of occurrences. The following screen is what +you can expect to see after typing in the 3 commands. + +image::normal_statistics.PNG[] + +==== Updating of statistics + +Every time you decide to add a request, edit a request, delete a request or even undo and redo a request, it is +important that the statistics display automatically keeps updating itself so that real-time accurate data is always +showed whenever you type in `statistics` + +Example of usage: + +Let’s assume you still have the requests of John Doe and Dohn Joe (requests that you had placed into HealthHub from the +previous section) in the request panel. You just received news that John Doe’s mobility has miraculously improved and +you no longer need to tag him with the ‘Physiotherapy’ health condition in his health request record. You, thus, decided +to edit John Doe’s health conditions from Diabetes and Physiotherapy to just Diabetes by issuing the following command: + +`edit r 1 c/Diabetes` + +image::statistics_before_edit.PNG[] + +You can then subsequently type in the following command to gather accurate statistical data, +which reflects the deletion of one of the ‘Physiotherapy’ health conditions: + +`statistics` + +image::statistics_after_edit.PNG[] + +After issuing the aforementioned commands, you now receive news that John Doe had not really recovered entirely yet, +and he still requires Physiotherapy treatment. Fret not! You can always issue the `undo` command to revert your changes to +John’s earlier set of health conditions (Physiotherapy and Diabetes) and then the `statistics` command to view the new +data. + +In essence, the `statistics` command is fully integrated with all request-related commands (`add`, `edit`, `delete`, +`undo`, `redo`, `clr`) in its pursuit of always providing accurate, real-time statistical information. + +==== Application of `statistics` in the workplace + +Upon collating such data, you can feedback and make suggestions to the hospital to increase or decrease training in +certain departments. Furthermore, you can even use this data as a basis for the health sector to ramp up efforts in its +Work Skills Qualification certification for certain healthcare skills to be taught to new aspiring healthcare +professionals. + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +=== Statistics Feature + +The statistics mechanism is facilitated by Statistics class, which is a public Java class containing a private static +TreeMap data structure and a private static LinkedHashMap data structure. The TreeMap contains key-value pairs, with the +names of health conditions as keys and the number of occurrences of each health condition as corresponding values. The +key-value pairs in the TreeMap are ordered in lexicographical order, whereas the LinkedHashMap is ordered in descending +order by value. + +The statistics feature is called every time the user decides to use any request-related commands (such as `add request`, +`edit r`, `delete r`, `undo`, `redo`, `clr`) since statistics need to keep track of every change in the frequency of all health +conditions. Therefore, the Statistics class also carries out the following operations: + +• updateStatistics(): updates statistics with new health condition-related data after add or edit commands are called +by the user. +• deleteStatistics(): updates statistics by specifically removing the health condition-related data that need to be +removed after the user calls the delete function. +• sortStatistics(): sorts statistics by value in descending order of the number of occurrences of each health +conditions, and puts the ordered key-value pairs into sortedMap +• undoRedoStatistics(): clears statistics and sortedMap completely and uses an ObservableList of all requests in the +request book to extract all the health conditions and their related number of occurrences. These health conditions and +their statistics are then added back to statistics and sortedMap +• clearStatistics(): renders both statistics and sortedMap empty after the user calls for the clr operation +• getConditionStatistics(): when the user specifically wants to know the number of occurrences for a particular health +condition + +Given below is an example of a usage scenario and how the statistics command is executed at each step: + +1. Starting up HealthHub: The user launches HealthHub for the first time. The `statistics` and `sortedMap` will be +initialized as an empty TreeMap and an empty LinkedHashMap respectively. + +2. Issuing Add Request Command: The user executes `add request n/John Doe i/S8974421C p/98765432 a/123 Brick Road, +#01-01 dt/01-01-2019 14:50:00 c/Diabetes c/Physiotherapy` command to add John Doe to the request book. The +aforementioned command also calls updateStatistics(), which takes in a Set containing Diabetes Condition and +Physiotherapy Condition, and adds an occurrence of one each to statistics. sortStatistics() is then subsequently called +to order the health conditions by value in sortedMap. + +3. Issuing Edit Request Command: The user executes `edit r 1 c/Diabetes` command to make changes to the first request +on the request panel in HealthHub. The aforementioned command also calls deleteStatistics(), which removes the +statistics of health conditions of the first request in statistics. updateStatistics() is then subsequently called to +add the new health condition (which in this case is just Diabetes) to statistics. sortStatistics() is lastly called to +order the health conditions by value in sortedMap. +4. Issuing Undo Request Command: The user executes `undo` command to reverse his earlier `edit r 1 c/Diabetes` command. +The aforementioned commands calls undoRedoStatistics(). This method first clears statistics and sortedMap, and then +takes an ObservableList of all requests from the request book. All health conditions are retrieved from the requests, +and are used to update statistics and sortedMap. + +The following sequence shows how the statistics operation works when called by LogicManager: + +image::statistics_command_sequence.png[] + +The following activity diagram summarizes what happens when a HealthHub user executes a new command: + +image::statistics_activity_diagram.png[] + +==== Design Considerations + +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +| Aspect +| Alternative 1 +| Alternative 2 + +| Choice of data structure for statistics and sortedMap +| statistics: use TreeMap + + sortedMap: use LinkedHashMap + +*Advantages*: + +1. Very fast retrieval of information with the TreeMap; guaranteed O(lgn) time complexity for containsKey, get, put, +remove operations. + +2. TreeMap entries are sorted in the natural ordering of its keys. + +3. Having 2 separate data structures (1 to contain alphabetically arranged health conditions and 1 to contain sorted +conditions by value) aids in the quicker retrieval of data + + +*Disadvantages*: + +1. Space costly to have 2 separate data structures containing the same information but in different orders + +| Use any other reasonable data structure like an ArrayList or a LinkedList + +*Advantages*: + +1. Very easy to implement and understand + +2. Space-efficient to have only 1 list of health conditions and their corresponding number of occurrences + +*Disadvantages*: + +1. Will need to create another wrapper class around Conditions and their number of occurrences since lists do not allow +for key-value pairing + +2. Retrieval of information for common operations like getting statistics for a particular condition may not be very +fast + +|======================================================================= + +Decision to go with Alternative 1: The team prioritized speed over space since in hospitals, should they want to +implement HealthHub, will not have an issue with having memory constraints. But they would definitely want to retrieve +data as fast as possible. Moreover, Alternative 1 seems far more scalable for future developments + +[width="100%",cols="1, 5, 5",options="header"] +|======================================================================= +| Aspect +| Alternative 1 +| Alternative 2 + +| How `statistics` executes +| The system saves an internal copy of statistics in its storage like a StatisticsBook, modelled after RequestBook or +HealthWorkerBook + +*Advantages*: + + 1. When HealthHub is closed and reopened, the old statistics will still exist. + +*Disadvantages*: + + 1. Takes up memory space since statistics will now need to be stored as .json files + + 2. Speed of retrieval will be lower since HealthHub will need to dig into its storage for data + +| Make the statistics class a static class. + +*Advantages*: + +1. Easier to implement; entirely removes the need for making storage files + +2. Speed of retrieval of data will be faster since it does not constantly need to keep digging into storage files + +*Disadvantages*: + +1. When HealthHub is closed and reopened, the old statistics will disappear since they have not been stored. + +|======================================================================= + +Decision to go with Alternative 2: Since RequestBook was already being stored in the storage component of HealthHub, +I found it redundant and space-inefficient to have to create another StatisticsBook to store statistical data, since all +of my statistical information can be found from the requests stored in RequestBook. I made sure that whenever +request-related commands were being executed (add, edit, delete, undo, redo, clr) statistics was also being updated in +tandem so that the statistical data was always accurate in real-time. + +To address the issue of losing statistical data upon closing down and reopening HealthHub, I have ensured that +statistics and sortedMap are initialized with latest data from the RequestBook during the init() method in the MainApp. + diff --git a/docs/team/daviddl9.adoc b/docs/team/daviddl9.adoc new file mode 100644 index 000000000000..5b52ad7b2f8b --- /dev/null +++ b/docs/team/daviddl9.adoc @@ -0,0 +1,293 @@ += David Livingston - Project Portfolio for HealthHub +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets +:xrefstyle: full +:experimental: +ifdef::env-github[] +:tip-caption: :bulb: +:note-caption: :information_source: +:source-highlighter: rouge +endif::[] + +== Overview +I am a software developer and second year computer science student at the National University of Singapore. I am really passionate about developing technology that can make the world a better place. This portfolio page documents my contributions to one of the most meaningful projects I've worked for - HealthHub. + +== Project: Health Hub + +=== About the project + +image::HealthHub.png[width=800] + +HealthHub is a https://en.wikipedia.org/wiki/Command-line_interface[command-line] desktop application built by my team and I, for our Software Engineering project. +We chose to morph it to a home-care patient management system, because of our passion in the health care industry. This enhanced application allows Hospital Administrators and senior management to create, assign and organise patient records seamlessly. HealhHub also organises staff information and manages statistics to assist in the Hospital's planning and allocation of resources. + +Note the following symbols and formatting used in this document: + +`add` A grey highlight (called a mark-up) indicates that this is a command that can be inputted into the command line and executed by the application. + +`Request` Grey highlight beginning with a capital letter indicates a component, class or object in the architecture of the application. + +== Summary of contributions + +* *Major enhancement*: Created the `Request` class to encapsulate a request, and it's relevant CRUD commands. +** What it does: Encapsulates the necessary information to be stored in a patient request. +** Justification: Laid the foundation to the entire project. All components of our project (UI, Storage, Logic and Model) required the creation of a `Request` class for further development of core functionality. +** Highlights: This enhancement affecting all existing classes, requiring some overhaul of the existing code base and thorough interaction of the differing components. + +//* *Major enhancement*: Created `add`, `edit`, `delete`, `list` and `clear` commands for the `Request` class. +//** What it does: Lays the foundation to any `Request` based functionality. Allows the user to organise the requests made by the patients seamlessly. +//** Justification: These enhancements provide necessary features to the admin so that the admin can create, edit or delete requests at any point of time. +//** Highlights: This enhancement affects the existing existing classes, like the [blue]`Healthworker` class. It required an in-depth analysis of design alternatives. The implementation was also challenging as it required changes to existing commands and classes, during the integration-testing phase. +//** Credits: Utilised the JACKSon library that serializes a [blue]`Request` object into JSON format for storage. This allows the user's state to be saved at all times. + +* *Major enhancement*: Created `assign` and `complete` request commands. +** What it does: Allows the admin to assign Healthworkers to requests, and complete any ongoing requests. +** Justification: These features are necessary for the product, and allows the administrator manage all patient requests by assigning the relevant healthworker with the appropriate skill sets. +** Highlights: Creation of these features required thorough understanding of how the existing details of the [blue]`Logic` and [blue]`Model` components, +as knowledge of how information is cached in the application's memory was essential to allow for rapid assigning. Also implemented a scheduling algorithm that allows users to ensure that requests assigned to `HealthWorker`s are at least 2 hours apart. +This prevents the user from accidentally assigning the same Healthworker to requests with clashing times. + +* *Minor enhancement*: added a filter command that allows the user to navigate through all requests stored by filtering by a specific value. + +* *Code contributed*: [https://nus-cs2103-ay1819s2.github.io/cs2103-dashboard/#search=daviddl9&sort=displayName&since=2019-02-10&until=2019-04-12&timeframe=day&reverse=false&repoSort=true[Reposense]] + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` onwards (3 releases) on GitHub +*** Added reposense compatibility +*** Added coveralls compatibility to project README +** Community: +*** PRs reviewed: https://github.com/CS2103-AY1819S2-W09-2/main/pulls?q=is%3Apr+is%3Aclosed+reviewed-by%3Adaviddl9[view here] +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/964[1], https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/743[2], https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/173[3], https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/12[4]) + +== Contributions to the User Guide + +=== *Filter requests*: + +Format: `filter request []` + +Shortcut(s): + +1. `filter r []` + +2. `filter 2 []` + +where `[ p/` +filters the request list for requests whose patient's name contains the +specified name substring *and* the specified phone number. +==== + +[NOTE] +==== +To revert the view back to the original request list, enter the `list request` command. +==== + +Examples: + +* `filter request n/alice` + +Returns all patients whose name contains "alice". +* `filter r p/9177` + +Returns all requests with contacts numbers that have "9177" in it's field. +* `filter 2 dt/30-01-2019 10:00:00` + +Returns all requests scheduled on 30th Jan 2019, at 10 am sharp. + +=== Filtering requests within a specific date range +Let's say you've grown to have an overwhelming number of requests, because you've been doing so successfully! Suppose you now would like to +look back and take a look at the requests that you had over a specific date range. You can do so using the following command: + +Format: `filter request dt/start dt/end` + +Shortcut(s): + +1. `filter r dt/start dt/end` + +2. `filter 2 dt/start dt/end` + +*Examples:* + +* `filter r dt/01-01-2019 00:00:00 dt/01-06-2019` 00:00:00 + +filters the requests between 1st Jan 2019 (inclusive) and 1st June 2019 (exclusive). + + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +=== Assign Request feature + +The assign request feature allows an administrator to assign a request to a particular healthworker. + +==== Current Implementation + +The following sequence diagram shows the sequence flow from the `LogicManager` to the `ModelManager` when a user enters a `assign request` command: + +image::assignreq.png[] +Figure 3.3.1.1 Sequence diagram to illustrate `Logic` component interactions for `assign request` command. + +image::assignReqToHw.png[] +Figure 3.3.1.2 Sequence diagram to illustrate `Logic` and `Model` component interactions for [blue]`AssignRequestCommand`. + +image::addHwRequestDates.png[] +Figure 3.3.1.3 Sequence diagram illustrates addition of the relevant `Date` objects into the `TreeSet` of the `healthWorker`. + +image::checkConflictingRequests.png[] +Figure 3.3.1.4 Sequence diagram illustrates interaction between `AssignRequestCommand` and `healthWorkerAppointments` + +1. When `LogicManager` receives the `execute` command, it calls the `parseCommand` method in `RequestBookParser`. +2. `RequestBookParser` will receive `assign` as the command and instantiate `AssignRequestCommandParser` to further parse the command. +3. If the arguments specified in the `assign` command are invalid, a `AssignCommand` will be created and returned back to the `LogicManager`. +4. `LogicManager` will proceed to call the `execute` command of `AssignCommand` +5. `AssignRequestCommand` will proceed to call the `getFilteredRequestList` method of `Model`. +6. Iterate through the `requestIds`, if valid, add the `request` corresponding to that `index` to the set of `Request`. +7. Iterates through all the requests already assigned to that `healthWorker`. If there is a conflict of schedule (i.e Requests assigned +to that healthWorker are less than 2 hours apart), a `CommandException` is thrown. +8. Writes the updated request to the `RequestBook` in `ModelManager`, if all the request timings are valid. + +==== Design Consideration + +===== Aspect: Algorithm in ensuring no clashing requests assigned to healthworkers - Data Structure and implementation +* Alternative 1 (current choice): Using a Balanced Binary Search Tree (java `TreeSet`) to keep track of the [blue]`RequestDate` of each request attended to by a particular `healthWorker`. +** Reasoning: Since the allowed time interval between 2 consecutive requests should be at least 2 hours, we can take advantage +of of this by only keeping track of the start time of requests. Hence we can utilise the `ceiling()`, `contains()` and `floor()` methods of the `TreeSet`, which runs effeciently in O(log N) time (where N is the number of requests). Here is the code snippet that implements this: +``` + // Note: healthWorkerAppointments is the TreeSet that stores the appointment dates + Date date = request.getRequestDate().getDate(); + calendar.setTime(date); + calendar.add(Calendar.HOUR_OF_DAY, -MIN_REQUEST_DURATION); // MIN_REQUEST_DURATION = 2 hours + Date lowerLimit = calendar.getTime(); + calendar.add(Calendar.HOUR_OF_DAY, 2 * MIN_REQUEST_DURATION); + Date upperLimit = calendar.getTime(); + + if (healthWorkerAppointments.contains(date) || (healthWorkerAppointments.lower(date) != null + && healthWorkerAppointments.lower(date).after(lowerLimit)) + || (healthWorkerAppointments.higher(date) != null + && healthWorkerAppointments.ceiling(date).before(upperLimit))) { + throw new CommandException(Messages.MESSAGE_HEALTHWORKER_OCCUPIED_CANNOT_ASSIGN); + } + + healthWorkerAppointments.add(date); +``` +Here is a pictorial representation of the algorithm: + +image::assignRegionCheck.png[] +Figure 3.3.1.5 Shows the visualisation of time ranges that are valid. + +* Alternative 2: For each request to be assigned, manually iterate through the Request list to ensure that there are not clashing dates. +Pros: Easy to implement +Cons: Slow - in the worst case, if all the requests get assigned at once, this operation will run in O(n^2) time. + +=== Add Request feature + +==== Current Implementation +The `add request` command allows the `LogicManager` to create a new request and add it to the list of requests. Adding a new request requires the +patient's name, patient's phone number, patient's address, patient's NRIC number and the patient's conditions. The format of the add request command is +add request n/NAME p/PHONE i/NRIC a/ADDRESS dt/DATETIME c/CONDITION. + +The following sequence shows the sequence when the add command is execute by the LogicManager: + +image::addrequest.png[width=800] +Figure 3.2.1.1 Sequence Diagram for `add request` command + +From the diagram above: + +. `LogicManager` 's execute is called when the administrator keys in `add request` and it calls upon `parseCommand` of `HealthHubParser` to parse the command +. `HealthHubParser` will initialize `AddCommandParser` and invoke the method `parse` to further parse the command. +. `parse` will be invoked and passed the parameters of the add command. +. If all the arguments of the `add` commands are valid, `AddRequestCommand` will be returned to the `LogicManager` +. `LogicManger` will then calls the method `execute` method of `AddRequestCommand` +. `AddRequestCommand` will call `addRequest` passing `Request` as an argument to `Model` and after calls `commitRequestBook` method from `Model`, if all the arguments in the `Request` are valid. +. A `CommandResult` will be returned at the end. + +==== Design Considerations +===== Aspect: Data Structure for the list of Requests +* **Alternative 1 (Current Approach):** Using a `UniqueRequestList` +** Pros: The comparison is not as rigid. You can create requests with similar names/phones as long as it passes a less stringent criteria. +** Cons: You need additional overhead. You need to create an extra class and function to check. + +* **Alternative 2:** Using a `Set` +** Pros: Do not need an extra function. You can use use `equals` for comparison +** Cons: It is a strict check and as a result you will not be allowed to create requests with same phone/same name etc. + +===== Aspect: Data Structure of `Request` +* **Alternative 1 (Current Approach):** All parameters in `Request` are abstracted out to have a class of its own. +** Pros: It adheres to the Single Responsibility Principles (SRP) and the Separation of Concerns (SoC) as each parameter checks whether it is valid +** Cons: Many different classes are created which increases the complexity of the code + +* **Alternative 2:** Store all parameters of `Request` as `String` +** Pros: Easy to implement. +** Cons: Violates SRP as one single class will need to check if the arguments are valid. + +[NOTE] +The `RequestStatus` class within the `Request` object utilises the Java `Enum` to ensure type safety in user inputs. + +The implementation of the `RequestStatus` class is as follows: + +``` + private enum Status { + PENDING, + ONGOING, + COMPLETED + } + + public RequestStatus(String status) { + this.requestState = Status.valueOf(status); + } +``` + +Through this, any user String that is passed in as an argument for the `RequestStatus` field is automatically type checked, +ensuring that there are no invalid request statuses entered. + +//include::../DeveloperGuide.adoc[tag=assignrequest] + +//include::../DeveloperGuide.adoc[tag=dataencryption] + diff --git a/docs/team/huichun66.adoc b/docs/team/huichun66.adoc new file mode 100644 index 000000000000..91610e3b5c05 --- /dev/null +++ b/docs/team/huichun66.adoc @@ -0,0 +1,95 @@ += Tay Hui Chun - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets +:icons: font + +== Project: Health Hub + +Hello there! Welcome to my project portfolio! This portfolio contains a list of contributions towards my CS2103T - Software Engineering module project, +which requires me to work in a team to morph an existing functional product to something else that solves a real-world problem. + +Health Hub is a desktop application that aims to get rid of the messy system of palliative care requests for health administrative staff. +Admin staff who are in-charge of assigning requests from patients to qualified health staff are often overwhelmed by the enormous filings and binders that take up so much of their time. + +image::Ui_home_orange.png[] + +My role in the team is to handle all the User Interface (UI) coding to render model data to display it to our users, who are hospital administrative staff. +Thinking that this is not enough to ensure a pleasant experience for our users, I extended some of the original functionalities from AddressBook4 and added a new command. +Tests in the form of component, integration and system tests are also added to ensure quality control. + + +== Overview +* Restructured most of the `.fxml` files associated with the UI components +* Wrote code to render the model data into the different UI components +* Wrote my own version of stylesheet to use for the application +* Handle logic for displaying a request's details in the `InfoPanel`, which is the center panel of the app. +* Extended the normal textfield to an additional autocomplete functionality. +* Added a `setreminder` command + +== Summary of Contributions + +* *Major Enhancement 1*: restructured the original AB4 UI code into different code that will suit the context of our application. +** What it does: Shows the lists of requests and health workers in two different panels. The UI has a center panel that displays a request's additional details that are not visible within the list, +such as the health staff assigned, and a static map overview of the patient's address. +** Justification: This is important as it is the interface that the user will be interacting with. Important details such as a patient's name and NRIC are displayed differently +compared to the other details such as phone or address. Special noteworthy details such as the conditions of a patient or the skills of a health worker are also displayed differently. +** Highlights: Coding the UI requires a deep understanding of how different UI components interact with each other and how the model data is rendered to the UI layer (via `ObservableValue`). +** Credits: Myself, but integrated a UI library called `font-awesome` in the application itself to render the display of icons related to request details. The static map is provided by `gothere.sg`. + +* *Major Enhancement 2*: added the ability for the user to select from a list of suggested commands, which is also known as an autocomplete feature. +** What it does: Shows a list of suggested commands based on the character that the user has typed in the text field. +** Justification: This is important as new users might be lost as to what kind of commands they can use. By having an autocomplete feature, they spend shorter time rewriting the same commands (e.g. adding 10 requests). +** Highlights: Since the `CommandBox` which contains the `AutoCompleteTextField`, is always used in the test cases, this new implementation affects the behaviour of existing test cases, especially the UI component and +systemtests and requires a thorough rework to resolve them. +** Credits: Myself, but had read some tutorials online on how to do it. + +* *Minor Enhancement*: added a `setreminder` command to further enhance the app's capability, by reminding the user of a task he or she needs to do within the day. + +* *Code Contributed*: [https://github.com/huichun66/main/tree/master/src/test/java/systemtests[Test code]] + +* *Other Contributions*: + +** Project Management: +*** Assigned the relevant issues to my teammates and suggested solutions for them to resolve it (Issues https://github.com/CS2103-AY1819S2-W09-2/main/issues/188[#188], +https://github.com/CS2103-AY1819S2-W09-2/main/issues/190[#190], +https://github.com/CS2103-AY1819S2-W09-2/main/issues/195[#195]) +** Enhancements to existing features: +*** Wrote the system tests that integrate newly implemented features to increase coverage from 82% to 90% (Pull requests https://github.com/CS2103-AY1819S2-W09-2/main/pull/209[#209], +https://github.com/CS2103-AY1819S2-W09-2/main/pull/217[#217], +https://github.com/CS2103-AY1819S2-W09-2/main/pull/219[#219]) +** Community: +*** Reviewed my teammate's PRs every week +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/221[1], +https://github.com/nus-cs2103-AY1819S2/pe-dry-run/issues/355[2]) + +== Contributions to the User Guide + +|=== +|_The sections below demonstrate how I used an emphathetic approach to educate the users of Health Hub on its features and future releases._ +|=== + +include::../UserGuide.adoc[tag=releasenotes-2.0] + +include::../UserGuide.adoc[tag=setreminder] + +|=== +|_In addition to the sections above, I also formatted the Command Summary table in the user guide in a neat manner so users are able to look for the key +information for the different commands._ +|=== + + +== Contributions to the Developer Guide + +|=== +|_The sections below showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=ui-header] + +include::../DeveloperGuide.adoc[tag=setreminder] + +include::../DeveloperGuide.adoc[tag=autocomplete] + +--- + diff --git a/docs/team/jing1324.adoc b/docs/team/jing1324.adoc new file mode 100644 index 000000000000..01ab6d7100e8 --- /dev/null +++ b/docs/team/jing1324.adoc @@ -0,0 +1,88 @@ += Jin Jing - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== Hello there +My name is Jin Jing and I am currently a second-year Computer Science student from the National University of Singapore. +I enjoy doing math and I like to solve logic problems in my spare time. + +https://github.com/jing1324[This is my Github] + +== Project: Health Hub + +== Overview + +Health Hub is a desktop application made for hospital administrative staff. +With the growing ageing population in Singapore, +we see more elderly needing Intermediate and Long-Term Care (ILTC) services. +With the increasing number of home healthcare requests, the current system in hospitals requires a lot of paper work +from the admin's side. + +Health Hub aims to reduce the workload of the admin by reducing the amount of paperwork +involved, hence improving the workflow of the system. + +The user interacts with it using a command line interface (CLI), and it has a graphics user interface(GUI). +It is written in Java and is a modification of the https://se-education.org/addressbook-level4/[AddressBook] originally made by seedu to help computer +science students learn software engineering. + +== Summary of contributions + +* *Enhancement 1*: Reimplemented undo/redo commands +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: The undo/redo feature provides a huge upgrade to the app, as it now allows the user to rectify the mistakes he/she made easily. +For example, if the user deleted a request by accident, he/she does not have to add back the request manually as the command can be undone with the `undo` command. +** Highlights: After the transformation from AddressBook to HealthHub, the old implementation of the undo/redo command was unable to support our new features. +Hence, in order to maintain the functionality as well as to improve the scalability of our app, it have to be reimplemented. +It is complicated to implement due to the various design considerations (See below for contributions in Developer's Guide ). +** Credits: https://se-education.org/addressbook-level4/[AddressBook] for the original implementation of the undo/redo feature. + +* *Enhancement 2*: Reimplemented storage component +** What is does: Stores all requests and health workers data into `json` text files whenever any of the data is edited or when app is closed. +** Justification: Storage is a necessary key feature in our app, having a storage system containing information of health workers and requests saves +a lot of time when the user wants to view the information of a specific request or health worker. He can simply filter for the conditions he want using the app +instead of searching the documents manually. +** Credits: https://se-education.org/addressbook-level4/[AddressBook] for the original implementation of the storage component. + +* *Code contributed*: [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/model/ModelManager.java[ModelManager]] + [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/model/ModifyCommandHistory.java[ModifyCommandHistory]] + [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/storage/JsonHealthWorkerBookStorage.java[HealthWorkerBookStorage]] + [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/storage/JsonSerializableHealthWorkerBook.java[SerializableHealthWorkerBook]] + [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/storage/JsonSerializableRequestBook.java[SerializableRequestBook]] + [https://github.com/CS2103-AY1819S2-W09-2/main/blob/master/src/main/java/seedu/address/storage/JsonRequestBookStorage.java[RequestBookStorage]] + +https://nus-cs2103-ay1819s2.github.io/cs2103-dashboard/#search=jing1324&sort=displayName&since=2019-02-10&until=2019-04-12&timeframe=day&reverse=false&repoSort=true[Click here to see all my code contributions] + +* *Other contributions*: + +** Enhancements to existing features: +*** Modified `Complete` command and `EditHealthWorker` command to support undo/redo features +** Community: +*** Consolidated a list of broken tests in the Issue tracker: https://github.com/CS2103-AY1819S2-W09-2/main/issues/130[#130] +*** Bug reports: https://github.com/CS2103-AY1819S2-W09-2/main/issues/160[#160], https://github.com/CS2103-AY1819S2-W09-2/main/issues/159[#159] +*** PRs reviewed (with non-trivial review comments): https://github.com/CS2103-AY1819S2-W09-2/main/pull/70[#70], https://github.com/CS2103-AY1819S2-W09-2/main/pull/47[#47], +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com/CS2103-AY1819S2-W10-1/main/issues/156[156], https://github.com/CS2103-AY1819S2-W10-1/main/issues/142[142], https://github.com/CS2103-AY1819S2-W10-1/main/issues/148[148]) + + +== Contributions to the User Guide + + +|=== +|_The following sections of the user guide were written by me. Do take a look._ +|=== + +include::../UserGuide.adoc[tag=undoredo] +include::../UserGuide.adoc[tag=releasenotes-1.4] + + + +== Contributions to the Developer Guide + +|=== +|_The following sections of the developer's guide were written by me. Please take a look._ +|=== + +include::../DeveloperGuide.adoc[tag=logic-header] +include::../DeveloperGuide.adoc[tag=storage] +include::../DeveloperGuide.adoc[tag=undoredo] + diff --git a/docs/team/johndoe.adoc b/docs/team/johndoe.adoc deleted file mode 100644 index 453c2152ab9d..000000000000 --- a/docs/team/johndoe.adoc +++ /dev/null @@ -1,72 +0,0 @@ -= John Doe - Project Portfolio -:site-section: AboutUs -:imagesDir: ../images -:stylesDir: ../stylesheets - -== PROJECT: AddressBook - Level 4 - ---- - -== Overview - -AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. - -== Summary of contributions - -* *Major enhancement*: added *the ability to undo/redo previous commands* -** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. -** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. -** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. -** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ - -* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. - -* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ - -* *Other contributions*: - -** Project management: -*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub -** Enhancements to existing features: -*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) -*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) -** Documentation: -*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] -** Community: -*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] -*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) -*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) -*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) -** Tools: -*** Integrated a third party library (Natty) to the project (https://github.com[#42]) -*** Integrated a new Github plugin (CircleCI) to the team repo - -_{you can add/remove categories in the list above}_ - -== Contributions to the User Guide - - -|=== -|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ -|=== - -include::../UserGuide.adoc[tag=undoredo] - -include::../UserGuide.adoc[tag=dataencryption] - -== Contributions to the Developer Guide - -|=== -|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ -|=== - -include::../DeveloperGuide.adoc[tag=undoredo] - -include::../DeveloperGuide.adoc[tag=dataencryption] - - -== PROJECT: PowerPointLabs - ---- - -_{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/team/lookuz.adoc b/docs/team/lookuz.adoc new file mode 100644 index 000000000000..0ba38d26280a --- /dev/null +++ b/docs/team/lookuz.adoc @@ -0,0 +1,187 @@ += Choong Wey Yeh - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== Project: Health Hub + +Greetings! I am a Year 2 undergraduate in NUS majoring in Computer Science +with a passion for solving real world problems using my technical expertise +in software development and technological knowledge. This portfolio details +the contributions that I have made to HealthHub, the considerations and also +the decisions made in my implementation of various functions in HealthHub. + +== Overview + +In light of the overwhelming workload of hospital administration teams due +to rising need for more and better healthcare services, we at +team W09-2 have designed and developed a desktop application that aims to +improve the hectic workload of hospital administrative staff by providing a +simple and efficient solution for managing requests for healthcare services +from home-stay patients: *HealthHub*. + +HealthHub is a desktop application built in Java and JavaFX that supports +both a Command Line Interface(CLI) and a Graphical User Interface(GUI), +providing the user with the flexbility to choose the mode of use that he or +she prefers. + +As a member of the team tasked with the development of HealthHub, my role was +to design the command logic structure for parsing commands and inputs +entered by the user, as well as implementing the logic for commands +involving `HealthWorker` which represents the details of medical experts +register in HealthHub. + +== Notation + +* Words used that are highlighted in grey represents an existing `Class` or +`Object` that is implemented in HealthHub. E.g `HealthWorker` denotes the +object used to describe the details representing a registered medical expert. + +[NOTE] +==== +Documentation under this section denotes any additional information used to +supplement existing description. +==== + +== Contributions + +=== Summary of Contributions + +Over the course of the development phase, I was tasked with the development +of `HealthWorker` related features in HealthHub, such as the basic Create, +Read, Update and Delete(CRUD) functionality. The enhancements and features +that I have contributed to HealthHub are: + +* Creation of the `HealthWorker` representation model for describing a +people working in the medical profession, in HealthHub. +* `add`, `edit` and `delete` commands for registering `HealthWorker` into +HealthHub. +* Designing and implementing the architecture for `CommandParser` to +provide flexibility for the development of other commands, as well as +streamline the performance of user input parsing. +* `filter` command for `HealthWorker` objects, utilizing a combination of +optimized data structures and methods from Java's `Predicate` and `Function` +library. + + +=== Major Enhancements + +* I reworked the `CommandParser` classes in HealthHub to facilitate the parsing + of inputs for commands involving both `HealthWorker` and `Request` objects. +** The original implementation of `CommandParser` class in AddressBook4 only +facilitated the adding of a `Person` class object into the system. As +HealthHub stored multiple different types of objects such as `HealthWorker` +and `Request`, I had to rework the existing implementation of `CommandParser` + in AddressBook4 to cater to the needs of our application. +** I created the `CommandMode` class for use in the new release for +`CommandParser` class, and overhauled the implementation to use `CommandMode` + to identify the specific type of object being handled, as well as to place + restrictions on unvalidated user inputs during commands. My contribution to + HealthHub via the `CommandParser` class paved the way for other teammates to + use the new revised `CommandParser` class for the development of their features + as well. +** Adjusted the implementation for `FilterCommandParser`, `ListCommandParser` +and `DeleteCommandParser` implemented by my teammates use `CommandMode` to +for a more seamless integration of the `filter`, `list` and `delete` commands + into HealthHub. + +* Added the functionality to filter `HealthWorker` objects in the HealthHub +system using various fields. +** In some of the user stories prior to the development of HealthHub, many +potential users greatly favored the capability to be able to search for +specific types of requests or medical workers, thus speeding up their search. +** To facilitate the ease of finding and assigning `HealthWorker` in HealthHub, +I implemented the ability to filter the existing list of +`HealthWorker`. As a result, Users are able to reduce their search for the +most appropriate health staff for assignment to requests to a shorter list +based on filter conditions they input. +** A significant difficulty that was faced when implementing this feature, is + the ability to combine multiple conditions of user inputs. The two main + solutions that were considered were firstly, storing all the filter + conditions into a `List) if content end - # Returns formatted style/link and script tags for header. + # Returns formatted style/link and script conditions for header. def styles_and_scripts scripts = [] styles = [] - tags = [] + conditions = [] stylesheet = attr :stylesheet stylesdir = attr :stylesdir, '' @@ -280,21 +280,21 @@ def styles_and_scripts styles.each do |item| if item.key?(:text) - tags << html_tag(:style, {}, item[:text]) + conditions << html_tag(:style, {}, item[:text]) else - tags << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href])) + conditions << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href])) end end scripts.each do |item| if item.key? :text - tags << html_tag(:script, {type: item[:type]}, item[:text]) + conditions << html_tag(:script, {type: item[:type]}, item[:text]) else - tags << html_tag(:script, type: item[:type], src: urlize(*item[:src])) + conditions << html_tag(:script, type: item[:type], src: urlize(*item[:src])) end end - tags.join "\n" + conditions.join "\n" end end diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d80b69a7665..09eaa16c323d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Feb 18 11:08:42 SGT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip diff --git a/src/main/java/seedu/address/MainApp.java b/src/main/java/seedu/address/MainApp.java index a92d4d5d71f0..ad882e077e24 100644 --- a/src/main/java/seedu/address/MainApp.java +++ b/src/main/java/seedu/address/MainApp.java @@ -1,5 +1,7 @@ package seedu.address; +import static seedu.address.logic.commands.Statistics.undoRedoStatistics; + import java.io.IOException; import java.nio.file.Path; import java.util.Optional; @@ -15,16 +17,20 @@ import seedu.address.commons.util.StringUtil; import seedu.address.logic.Logic; import seedu.address.logic.LogicManager; -import seedu.address.model.AddressBook; +import seedu.address.model.HealthWorkerBook; import seedu.address.model.Model; import seedu.address.model.ModelManager; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; import seedu.address.model.ReadOnlyUserPrefs; +import seedu.address.model.RequestBook; import seedu.address.model.UserPrefs; import seedu.address.model.util.SampleDataUtil; -import seedu.address.storage.AddressBookStorage; -import seedu.address.storage.JsonAddressBookStorage; +import seedu.address.storage.HealthWorkerBookStorage; +import seedu.address.storage.JsonHealthWorkerBookStorage; +import seedu.address.storage.JsonRequestBookStorage; import seedu.address.storage.JsonUserPrefsStorage; +import seedu.address.storage.RequestBookStorage; import seedu.address.storage.Storage; import seedu.address.storage.StorageManager; import seedu.address.storage.UserPrefsStorage; @@ -48,7 +54,7 @@ public class MainApp extends Application { @Override public void init() throws Exception { - logger.info("=============================[ Initializing AddressBook ]==========================="); + logger.info("=============================[ Initializing Health Hub ]==========================="); super.init(); AppParameters appParameters = AppParameters.parse(getParameters()); @@ -56,41 +62,63 @@ public void init() throws Exception { UserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(config.getUserPrefsFilePath()); UserPrefs userPrefs = initPrefs(userPrefsStorage); - AddressBookStorage addressBookStorage = new JsonAddressBookStorage(userPrefs.getAddressBookFilePath()); - storage = new StorageManager(addressBookStorage, userPrefsStorage); + RequestBookStorage requestBookStorage = new JsonRequestBookStorage(userPrefs.getRequestBookFilePath()); + HealthWorkerBookStorage healthWorkerBookStorage = new JsonHealthWorkerBookStorage( + userPrefs.getHealthWorkerBookFilePath()); + storage = new StorageManager(userPrefsStorage, requestBookStorage, + healthWorkerBookStorage); initLogging(config); model = initModelManager(storage, userPrefs); + undoRedoStatistics(model); + logic = new LogicManager(model, storage); ui = new UiManager(logic); } /** - * Returns a {@code ModelManager} with the data from {@code storage}'s address book and {@code userPrefs}.
- * The data from the sample address book will be used instead if {@code storage}'s address book is not found, - * or an empty address book will be used instead if errors occur when reading {@code storage}'s address book. + * Returns a {@code ModelManager} with the data from {@code storage}'s address + * book and {@code userPrefs}.
+ * The data from the sample address book will be used instead if + * {@code storage}'s address book is not found, or an empty address book will be + * used instead if errors occur when reading {@code storage}'s address book. */ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) { - Optional addressBookOptional; - ReadOnlyAddressBook initialData; + Optional healthWorkerBookOptional; + Optional requestBookOptional; + ReadOnlyHealthWorkerBook initialHealthWorkerBook; + ReadOnlyRequestBook initialRequestBook; + try { - addressBookOptional = storage.readAddressBook(); - if (!addressBookOptional.isPresent()) { - logger.info("Data file not found. Will be starting with a sample AddressBook"); + + healthWorkerBookOptional = storage.readHealthWorkerBook(); + requestBookOptional = storage.readRequestBook(); + + if (!requestBookOptional.isPresent()) { + logger.info("RequestBook file not found. Will be starting with sample RequestBook"); } - initialData = addressBookOptional.orElseGet(SampleDataUtil::getSampleAddressBook); + if (!healthWorkerBookOptional.isPresent()) { + logger.info("HealthWorkerBook file not found. Will be starting with a sample HealthWorkerBook"); + } + initialRequestBook = requestBookOptional.orElseGet(SampleDataUtil::getSampleRequestBook); + initialHealthWorkerBook = healthWorkerBookOptional.orElseGet(SampleDataUtil::getSampleHealthWorkerBook); + + } catch (DataConversionException e) { - logger.warning("Data file not in the correct format. Will be starting with an empty AddressBook"); - initialData = new AddressBook(); + logger.warning("Data file not in the correct format. Will be starting with empty books"); + initialHealthWorkerBook = new HealthWorkerBook(); + initialRequestBook = new RequestBook(); } catch (IOException e) { - logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook"); - initialData = new AddressBook(); + logger.warning("Problem while reading from the file. Will be starting with empty books"); + initialHealthWorkerBook = new HealthWorkerBook(); + initialRequestBook = new RequestBook(); } - return new ModelManager(initialData, userPrefs); + + return new ModelManager(initialHealthWorkerBook, initialRequestBook, userPrefs); } private void initLogging(Config config) { @@ -124,7 +152,8 @@ protected Config initConfig(Path configFilePath) { initializedConfig = new Config(); } - //Update config file in case it was missing to begin with or there are new/unused fields + // Update config file in case it was missing to begin with or there are + // new/unused fields try { ConfigUtil.saveConfig(initializedConfig, configFilePathUsed); } catch (IOException e) { @@ -134,9 +163,9 @@ protected Config initConfig(Path configFilePath) { } /** - * Returns a {@code UserPrefs} using the file at {@code storage}'s user prefs file path, - * or a new {@code UserPrefs} with default configuration if errors occur when - * reading from the file. + * Returns a {@code UserPrefs} using the file at {@code storage}'s user prefs + * file path, or a new {@code UserPrefs} with default configuration if errors + * occur when reading from the file. */ protected UserPrefs initPrefs(UserPrefsStorage storage) { Path prefsFilePath = storage.getUserPrefsFilePath(); @@ -151,11 +180,12 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) { + "Using default user prefs"); initializedPrefs = new UserPrefs(); } catch (IOException e) { - logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook"); + logger.warning("Problem while reading from the file. Will be starting with an empty books"); initializedPrefs = new UserPrefs(); } - //Update prefs file in case it was missing to begin with or there are new/unused fields + // Update prefs file in case it was missing to begin with or there are + // new/unused fields try { storage.saveUserPrefs(initializedPrefs); } catch (IOException e) { @@ -167,17 +197,22 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) { @Override public void start(Stage primaryStage) { - logger.info("Starting AddressBook " + MainApp.VERSION); + logger.info("Starting Health Hub " + MainApp.VERSION); ui.start(primaryStage); } @Override public void stop() { - logger.info("============================ [ Stopping Address Book ] ============================="); + logger.info("============================ [ Stopping Health Hub ] ============================="); try { + storage.saveHealthWorkerBook(model.getHealthWorkerBook()); + storage.saveRequestBook(model.getRequestBook()); storage.saveUserPrefs(model.getUserPrefs()); } catch (IOException e) { logger.severe("Failed to save preferences " + StringUtil.getDetails(e)); + } finally { + // to fix timer task not stopping + System.exit(0); } } diff --git a/src/main/java/seedu/address/commons/core/Commands.java b/src/main/java/seedu/address/commons/core/Commands.java new file mode 100644 index 000000000000..839554c113cb --- /dev/null +++ b/src/main/java/seedu/address/commons/core/Commands.java @@ -0,0 +1,54 @@ +package seedu.address.commons.core; + +import java.util.Arrays; +import java.util.List; + +/** + * Container for all commonly used commands + */ +public class Commands { + + public static final String ADD = "add"; + public static final String ADD_HEALTH_WORKER = "add healthworker n/Judy Hopps i/S8974421C p/98765432 " + + "o/SGH s/GENERAL_PRACTICE s/ORTHOPAEDIC"; + public static final String ADD_HEALTH_WORKER_MODE = "add 1 n/Judy Hopps i/S8974421C p/98765432 " + + "o/SGH s/GENERAL_PRACTICE s/ORTHOPAEDIC"; + public static final String ADD_REQUEST = "add request n/John Doe i/S8974421C p/98765432 " + + "a/123 Brick Road, #01-01 dt/01-01-2019 14:50:00 c/Diabetic c/Physiotherapy"; + public static final String ADD_REQUEST_MODE = "add 2 n/John Doe i/S8974421C p/98765432 " + + "a/123 Brick Road, #01-01 dt/01-01-2019 14:50:00 c/Diabetic c/Physiotherapy"; + public static final String EDIT = "edit"; + public static final String EDIT_HEALTH_WORKER = "edit healthworker n/Judy Hopps"; + public static final String EDIT_HEALTH_WORKER_MODE = "edit 1 n/Judy Hopps"; + public static final String EDIT_REQUEST = "edit request n/John Doe"; + public static final String EDIT_REQUEST_MODE = "edit 2 n/John Doe"; + public static final String LIST = "list"; + public static final String LIST_ALL_HEALTHWORKER = "list healthworker"; + public static final String LIST_ALL_HEALTHWORKER_MODE = "list 1"; + public static final String LIST_ALL_REQUEST = "list request"; + public static final String LIST_ALL_REQUEST_MODE = "list 2"; + public static final String ASSIGN = "assign"; + public static final String ASSIGN_REQUEST = "assign hw/1 r/2"; + public static final String COMPLETE = "complete"; + public static final String FILTER = "filter"; + public static final String FIND_REQUEST = "frequest"; + public static final String SELECT = "select"; + public static final String DELETE = "delete"; + public static final String CLEAR = "clr"; + public static final String HISTORY = "history"; + public static final String STATISTICS = "statistics"; + public static final String SET_REMINDER = "setreminder"; + public static final String SET_REMINDER_FULL = "setreminder t/05:00:00 m/call patient John Doe for his appointment"; + public static final String UNDO = "undo"; + public static final String REDO = "redo"; + public static final String HELP = "help"; + public static final String EXIT = "exit"; + + public static List getAllCommands() { + return Arrays.asList(ADD, ADD_HEALTH_WORKER, ADD_HEALTH_WORKER_MODE, ADD_REQUEST, ADD_REQUEST_MODE, EDIT, + EDIT_HEALTH_WORKER, EDIT_HEALTH_WORKER_MODE, EDIT_REQUEST, EDIT_REQUEST_MODE, LIST, + LIST_ALL_HEALTHWORKER, LIST_ALL_HEALTHWORKER_MODE, LIST_ALL_REQUEST, LIST_ALL_REQUEST_MODE, + ASSIGN, ASSIGN_REQUEST, COMPLETE, FILTER, FIND_REQUEST, SELECT, DELETE, CLEAR, HISTORY, STATISTICS, + SET_REMINDER, SET_REMINDER_FULL, UNDO, REDO, HELP, EXIT); + } +} diff --git a/src/main/java/seedu/address/commons/core/LogsCenter.java b/src/main/java/seedu/address/commons/core/LogsCenter.java index 431e7185e762..ac24fe2629ec 100644 --- a/src/main/java/seedu/address/commons/core/LogsCenter.java +++ b/src/main/java/seedu/address/commons/core/LogsCenter.java @@ -18,7 +18,7 @@ public class LogsCenter { private static final int MAX_FILE_COUNT = 5; private static final int MAX_FILE_SIZE_IN_BYTES = (int) (Math.pow(2, 20) * 5); // 5MB - private static final String LOG_FILE = "addressbook.log"; + private static final String LOG_FILE = "healthhub.log"; private static Level currentLogLevel = Level.INFO; private static final Logger logger = LogsCenter.getLogger(LogsCenter.class); private static FileHandler fileHandler; diff --git a/src/main/java/seedu/address/commons/core/Messages.java b/src/main/java/seedu/address/commons/core/Messages.java index 1deb3a1e4695..31f3f80fa627 100644 --- a/src/main/java/seedu/address/commons/core/Messages.java +++ b/src/main/java/seedu/address/commons/core/Messages.java @@ -6,8 +6,29 @@ public class Messages { public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command"; - public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s"; + public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n\n%1$s"; public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid"; - public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!"; + public static final String MESSAGE_HEALTHWORKER_LISTED_OVERVIEW = "%1$d health workers listed"; + public static final String MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX = "The request index " + + "provided is invalid"; + public static final String MESSAGE_INVALID_HEALTHWORKER_DISPLAYED_INDEX = "The healthworker " + + "index provided is invalid."; + public static final String MESSAGE_REQUESTS_LISTED_OVERVIEW = "%1$d requests listed!"; + public static final String MESSAGE_INVALID_REQUEST_COMMAND_FORMAT = "Invalid request command " + + "format! \n%1$s"; + public static final String MESSAGE_REQUEST_ONGOING_CANNOT_CLEAR = "There is at least one " + + "ongoing request in the list, request list cannot be cleared."; + public static final String MESSAGE_REQUEST_COMPLETED_CANNOT_ASSIGN = "Completed request " + + "cannot be assigned. To make changes to a completed request, use edit instead."; + public static final String MESSAGE_HEALTHWORKER_ASSIGNED_CANNOT_DELETE = "Health Worker is currently assigned to " + + "one or more request. Please close or reassigned these requests before deleting this Health Worker."; + public static final String MESSAGE_HEALTHWORKER_OCCUPIED_CANNOT_ASSIGN = "Healthworker assigned" + + " is busy with another request during one of the time intervals. Ensure that requests " + + "are at least 2 hours apart."; + public static final String MESSAGE_HEALTHWORKER_ALREADY_ASSIGNED = "One of the request(s) " + + "selected is already assigned to this healthworker."; + public static final String MESSAGE_EDITED_TIME_HEALTHWORKER_UNAVAILABLE = "The healthworker " + + "assigned is not available during this specified time. Ensure that requests allocated to " + + "a healthworker are at least 2 hours apart."; } diff --git a/src/main/java/seedu/address/commons/core/Version.java b/src/main/java/seedu/address/commons/core/Version.java index e117f91b3b2e..d41a21310cea 100644 --- a/src/main/java/seedu/address/commons/core/Version.java +++ b/src/main/java/seedu/address/commons/core/Version.java @@ -29,22 +29,6 @@ public Version(int major, int minor, int patch, boolean isEarlyAccess) { this.isEarlyAccess = isEarlyAccess; } - public int getMajor() { - return major; - } - - public int getMinor() { - return minor; - } - - public int getPatch() { - return patch; - } - - public boolean isEarlyAccess() { - return isEarlyAccess; - } - /** * Parses a version number string in the format V1.2.3. * @param versionString version number string @@ -61,9 +45,26 @@ public static Version fromString(String versionString) throws IllegalArgumentExc return new Version(Integer.parseInt(versionMatcher.group(1)), Integer.parseInt(versionMatcher.group(2)), Integer.parseInt(versionMatcher.group(3)), - versionMatcher.group(4) == null ? false : true); + versionMatcher.group(4) != null); } + public int getMajor() { + return major; + } + + public int getMinor() { + return minor; + } + + public int getPatch() { + return patch; + } + + public boolean isEarlyAccess() { + return isEarlyAccess; + } + + @Override @JsonValue public String toString() { return String.format("V%d.%d.%d%s", major, minor, patch, isEarlyAccess ? "ea" : ""); diff --git a/src/main/java/seedu/address/commons/util/StringUtil.java b/src/main/java/seedu/address/commons/util/StringUtil.java index 61cc8c9a1cb8..b6dee1ecb160 100644 --- a/src/main/java/seedu/address/commons/util/StringUtil.java +++ b/src/main/java/seedu/address/commons/util/StringUtil.java @@ -52,7 +52,8 @@ public static String getDetails(Throwable t) { * Returns true if {@code s} represents a non-zero unsigned integer * e.g. 1, 2, 3, ..., {@code Integer.MAX_VALUE}
* Will return false for any other non-null string input - * e.g. empty string, "-1", "0", "+1", and " 2 " (untrimmed), "3 0" (contains whitespace), "1 a" (contains letters) + * e.g. empty string, "-1", "0", "+1", and " 2 " (untrimmed), "3 0" (contains whitespace), "1 a" (contains + * letters) * @throws NullPointerException if {@code s} is null. */ public static boolean isNonZeroUnsignedInteger(String s) { diff --git a/src/main/java/seedu/address/logic/Logic.java b/src/main/java/seedu/address/logic/Logic.java index 60369e2074e4..a1e245367e08 100644 --- a/src/main/java/seedu/address/logic/Logic.java +++ b/src/main/java/seedu/address/logic/Logic.java @@ -4,15 +4,19 @@ import javafx.beans.property.ReadOnlyProperty; import javafx.collections.ObservableList; + import seedu.address.commons.core.GuiSettings; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Person; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.request.Request; /** * API of the Logic component + * */ public interface Logic { /** @@ -25,14 +29,22 @@ public interface Logic { CommandResult execute(String commandText) throws CommandException, ParseException; /** - * Returns the AddressBook. * - * @see seedu.address.model.Model#getAddressBook() + * @see seedu.address.model.Model#getRequestBook() + */ + ReadOnlyRequestBook getRequestBook(); + + /** + * + * @see seedu.address.model.Model#getHealthWorkerBook() */ - ReadOnlyAddressBook getAddressBook(); + ReadOnlyHealthWorkerBook getHealthWorkerBook(); - /** Returns an unmodifiable view of the filtered list of persons */ - ObservableList getFilteredPersonList(); + /** Returns an unmodifiable view of the filtered list of health workers */ + ObservableList getFilteredHealthWorkerList(); + + /** Returns an unmodifiable view of the filtered list of requests */ + ObservableList getFilteredRequestList(); /** * Returns an unmodifiable view of the list of commands entered by the user. @@ -41,9 +53,14 @@ public interface Logic { ObservableList getHistory(); /** - * Returns the user prefs' address book file path. + * Returns the user prefs'request book file path. */ - Path getAddressBookFilePath(); + Path getRequestBookFilePath(); + + /** + * Returns the user prefs' health worker book file path. + */ + Path getHealthWorkerBookFilePath(); /** * Returns the user prefs' GUI settings. @@ -55,18 +72,27 @@ public interface Logic { */ void setGuiSettings(GuiSettings guiSettings); + /** - * Selected person in the filtered person list. - * null if no person is selected. - * - * @see seedu.address.model.Model#selectedPersonProperty() + * Selected health worker in the filtered health worker list. + * null if no health worker is selected. */ - ReadOnlyProperty selectedPersonProperty(); + ReadOnlyProperty selectedHealthWorkerProperty(); /** - * Sets the selected person in the filtered person list. - * - * @see seedu.address.model.Model#setSelectedPerson(Person) + * Selected request in the filtered request list. + * null if no request is selected. + */ + ReadOnlyProperty selectedRequestProperty(); + + + /** + * Sets the selected health worker in the filtered health worker list. + */ + void setSelectedHealthWorker(HealthWorker worker); + + /** + * Sets the selected request in the filtered request list. */ - void setSelectedPerson(Person person); + void setSelectedRequest(Request request); } diff --git a/src/main/java/seedu/address/logic/LogicManager.java b/src/main/java/seedu/address/logic/LogicManager.java index 5cb24a617beb..7abe3b133aa0 100644 --- a/src/main/java/seedu/address/logic/LogicManager.java +++ b/src/main/java/seedu/address/logic/LogicManager.java @@ -11,53 +11,69 @@ import seedu.address.logic.commands.Command; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.parser.AddressBookParser; +import seedu.address.logic.parser.HealthHubParser; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.Model; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Person; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.request.Request; import seedu.address.storage.Storage; /** * The main LogicManager of the app. */ public class LogicManager implements Logic { + public static final String FILE_OPS_ERROR_MESSAGE = "Could not save data to file: "; private final Logger logger = LogsCenter.getLogger(LogicManager.class); private final Model model; private final Storage storage; private final CommandHistory history; - private final AddressBookParser addressBookParser; - private boolean addressBookModified; + private final HealthHubParser healthHubParser; + private boolean requestBookModified; + private boolean healthWorkerBookModified; public LogicManager(Model model, Storage storage) { this.model = model; this.storage = storage; - history = new CommandHistory(); - addressBookParser = new AddressBookParser(); + this.history = new CommandHistory(); + this.healthHubParser = new HealthHubParser(); // Set addressBookModified to true whenever the models' address book is modified. - model.getAddressBook().addListener(observable -> addressBookModified = true); + model.getRequestBook().addListener(observable -> requestBookModified = true); + model.getHealthWorkerBook().addListener(observable -> healthWorkerBookModified = true); + } @Override public CommandResult execute(String commandText) throws CommandException, ParseException { - logger.info("----------------[USER COMMAND][" + commandText + "]"); - addressBookModified = false; + logger.info("-----------------[USER COMMAND][" + commandText + "]-------------------"); + requestBookModified = false; + healthWorkerBookModified = false; CommandResult commandResult; try { - Command command = addressBookParser.parseCommand(commandText); + Command command = healthHubParser.parseCommand(commandText); commandResult = command.execute(model, history); } finally { history.add(commandText); } - if (addressBookModified) { - logger.info("Address book modified, saving to file."); + if (requestBookModified) { + logger.info("Request book modified, saving to file."); try { - storage.saveAddressBook(model.getAddressBook()); + storage.saveRequestBook(model.getRequestBook()); + } catch (IOException ioe) { + throw new CommandException(FILE_OPS_ERROR_MESSAGE + ioe, ioe); + } + } + + if (healthWorkerBookModified) { + logger.info("Health worker book modified, saving to file."); + try { + storage.saveHealthWorkerBook(model.getHealthWorkerBook()); } catch (IOException ioe) { throw new CommandException(FILE_OPS_ERROR_MESSAGE + ioe, ioe); } @@ -67,25 +83,34 @@ public CommandResult execute(String commandText) throws CommandException, ParseE } @Override - public ReadOnlyAddressBook getAddressBook() { - return model.getAddressBook(); + public ReadOnlyRequestBook getRequestBook() { + return model.getRequestBook(); } @Override - public ObservableList getFilteredPersonList() { - return model.getFilteredPersonList(); + public ReadOnlyHealthWorkerBook getHealthWorkerBook() { + return model.getHealthWorkerBook(); } @Override - public ObservableList getHistory() { - return history.getHistory(); + public ObservableList getFilteredRequestList() { + return model.getFilteredRequestList(); } + + @Override + public ObservableList getFilteredHealthWorkerList() { + return model.getFilteredHealthWorkerList(); } + + @Override + public Path getRequestBookFilePath() { + return model.getRequestBookFilePath(); } @Override - public Path getAddressBookFilePath() { - return model.getAddressBookFilePath(); + public Path getHealthWorkerBookFilePath() { + return model.getHealthWorkerBookFilePath(); } + @Override public GuiSettings getGuiSettings() { return model.getGuiSettings(); @@ -97,12 +122,26 @@ public void setGuiSettings(GuiSettings guiSettings) { } @Override - public ReadOnlyProperty selectedPersonProperty() { - return model.selectedPersonProperty(); + public ReadOnlyProperty selectedRequestProperty() { + return model.selectedRequestProperty(); + } + + @Override + public ReadOnlyProperty selectedHealthWorkerProperty() { + return model.selectedHealthWorkerProperty(); } + + @Override + public void setSelectedRequest(Request request) { + model.setSelectedRequest(request); + } + + @Override + public void setSelectedHealthWorker(HealthWorker worker) { + model.setSelectedHealthWorker(worker); } @Override - public void setSelectedPerson(Person person) { - model.setSelectedPerson(person); + public ObservableList getHistory() { + return history.getHistory(); } } diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index d88e831ff1ce..fb421f52fafe 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -1,69 +1,15 @@ package seedu.address.logic.commands; -import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; - -import seedu.address.logic.CommandHistory; -import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; -import seedu.address.model.person.Person; /** - * Adds a person to the address book. + * Abstract class representing a command to add objects to the addressbook. + * @author Lookaz */ -public class AddCommand extends Command { +public abstract class AddCommand extends Command { public static final String COMMAND_WORD = "add"; + public static final String MESSAGE_USAGE = "The different modes for registering a new item are as follows:\n"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " - + "Parameters: " - + PREFIX_NAME + "NAME " - + PREFIX_PHONE + "PHONE " - + PREFIX_EMAIL + "EMAIL " - + PREFIX_ADDRESS + "ADDRESS " - + "[" + PREFIX_TAG + "TAG]...\n" - + "Example: " + COMMAND_WORD + " " - + PREFIX_NAME + "John Doe " - + PREFIX_PHONE + "98765432 " - + PREFIX_EMAIL + "johnd@example.com " - + PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " - + PREFIX_TAG + "friends " - + PREFIX_TAG + "owesMoney"; - - public static final String MESSAGE_SUCCESS = "New person added: %1$s"; - public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; - - private final Person toAdd; - - /** - * Creates an AddCommand to add the specified {@code Person} - */ - public AddCommand(Person person) { - requireNonNull(person); - toAdd = person; - } - - @Override - public CommandResult execute(Model model, CommandHistory history) throws CommandException { - requireNonNull(model); - - if (model.hasPerson(toAdd)) { - throw new CommandException(MESSAGE_DUPLICATE_PERSON); - } - - model.addPerson(toAdd); - model.commitAddressBook(); - return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd)); - } - - @Override - public boolean equals(Object other) { - return other == this // short circuit if same object - || (other instanceof AddCommand // instanceof handles nulls - && toAdd.equals(((AddCommand) other).toAdd)); - } + public abstract void add(Model model, Object toAdd); // method for adding the respective object } diff --git a/src/main/java/seedu/address/logic/commands/AddHealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/AddHealthWorkerCommand.java new file mode 100644 index 000000000000..79337b2033d1 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/AddHealthWorkerCommand.java @@ -0,0 +1,53 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * Adds a HealthWorker to the address book. + * @author Lookaz + */ +public class AddHealthWorkerCommand extends AddCommand implements HealthWorkerCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + " " + COMMAND_OPTION + + ": Add a health worker to the address book. Parameters:" + ADD_COMMAND_PARAMETERS + "\n" + + "Example: " + COMMAND_WORD + " " + ADD_COMMAND_EXAMPLE; + + public static final String MESSAGE_SUCCESS = "New health worker added: %1$s"; + + private final HealthWorker toAdd; + + public AddHealthWorkerCommand(HealthWorker toAdd) { + requireNonNull(toAdd); + this.toAdd = toAdd; + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + if (model.hasHealthWorker(toAdd)) { + throw new CommandException(DUPLICATE_HEALTH_WORKER); + } + + add(model, toAdd); + return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd)); + } + + @Override + public void add(Model model, Object toAdd) { + model.addHealthWorker((HealthWorker) toAdd); + //model.commitHealthWorkerBook(); + commitHealthWorkerBook(model); + } + + @Override + public boolean equals(Object other) { + return (other == this) || (other instanceof AddHealthWorkerCommand + && (this.toAdd.equals(((AddHealthWorkerCommand) other).toAdd))); + } +} diff --git a/src/main/java/seedu/address/logic/commands/ClearCommand.java b/src/main/java/seedu/address/logic/commands/ClearCommand.java index a22219ad76ad..dc036d33f648 100644 --- a/src/main/java/seedu/address/logic/commands/ClearCommand.java +++ b/src/main/java/seedu/address/logic/commands/ClearCommand.java @@ -1,25 +1,24 @@ -package seedu.address.logic.commands; - -import static java.util.Objects.requireNonNull; - -import seedu.address.logic.CommandHistory; -import seedu.address.model.AddressBook; -import seedu.address.model.Model; - -/** - * Clears the address book. - */ -public class ClearCommand extends Command { - - public static final String COMMAND_WORD = "clear"; - public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; - - - @Override - public CommandResult execute(Model model, CommandHistory history) { - requireNonNull(model); - model.setAddressBook(new AddressBook()); - model.commitAddressBook(); - return new CommandResult(MESSAGE_SUCCESS); - } -} +//package seedu.address.logic.commands; +// +//import static java.util.Objects.requireNonNull; +// +//import seedu.address.logic.CommandHistory; +//import seedu.address.model.Model; +// +///** +// * Clears the address book. +// */ +//public class ClearCommand extends Command { +// +// public static final String COMMAND_WORD = "clear"; +// public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; +// +// +// @Override +// public CommandResult execute(Model model, CommandHistory history) { +// requireNonNull(model); +// model.setAddressBook(new AddressBook()); +// model.commitAddressBook(); +// return new CommandResult(MESSAGE_SUCCESS); +// } +//} diff --git a/src/main/java/seedu/address/logic/commands/CommandResult.java b/src/main/java/seedu/address/logic/commands/CommandResult.java index 92f900b7916d..7b1458b318f1 100644 --- a/src/main/java/seedu/address/logic/commands/CommandResult.java +++ b/src/main/java/seedu/address/logic/commands/CommandResult.java @@ -68,4 +68,11 @@ public int hashCode() { return Objects.hash(feedbackToUser, showHelp, exit); } + @Override + public String toString() { + return "Message: " + feedbackToUser + "\n" + + "showhelp: " + showHelp + "\n" + + "exit: " + exit + "\n"; + } + } diff --git a/src/main/java/seedu/address/logic/commands/DeleteCommand.java b/src/main/java/seedu/address/logic/commands/DeleteCommand.java index a20e9d49eac7..7ff7ef5ce5ae 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteCommand.java +++ b/src/main/java/seedu/address/logic/commands/DeleteCommand.java @@ -2,54 +2,28 @@ import static java.util.Objects.requireNonNull; -import java.util.List; - -import seedu.address.commons.core.Messages; import seedu.address.commons.core.index.Index; -import seedu.address.logic.CommandHistory; -import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; -import seedu.address.model.person.Person; /** - * Deletes a person identified using it's displayed index from the address book. + * @author Lookaz + * Abstract class representing command to delete objects. */ -public class DeleteCommand extends Command { +public abstract class DeleteCommand extends Command { public static final String COMMAND_WORD = "delete"; - public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Deletes the person identified by the index number used in the displayed person list.\n" - + "Parameters: INDEX (must be a positive integer)\n" - + "Example: " + COMMAND_WORD + " 1"; - - public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Person: %1$s"; - - private final Index targetIndex; - - public DeleteCommand(Index targetIndex) { - this.targetIndex = targetIndex; - } - - @Override - public CommandResult execute(Model model, CommandHistory history) throws CommandException { - requireNonNull(model); - List lastShownList = model.getFilteredPersonList(); + protected final Index index; - if (targetIndex.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - - Person personToDelete = lastShownList.get(targetIndex.getZeroBased()); - model.deletePerson(personToDelete); - model.commitAddressBook(); - return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, personToDelete)); + public DeleteCommand(Index index) { + requireNonNull(index); + this.index = index; } - @Override - public boolean equals(Object other) { - return other == this // short circuit if same object - || (other instanceof DeleteCommand // instanceof handles nulls - && targetIndex.equals(((DeleteCommand) other).targetIndex)); // state check - } + /** + * Method to delete object from Model. + * @param model Model to remove the object from. + * @param toDelete Object to be removed. + */ + public abstract void delete(Model model, Object toDelete); } diff --git a/src/main/java/seedu/address/logic/commands/DeleteHealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/DeleteHealthWorkerCommand.java new file mode 100644 index 000000000000..7936602a80ce --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/DeleteHealthWorkerCommand.java @@ -0,0 +1,69 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * Deletes a HealthWorker from the addressbook based on the index specified. + */ +public class DeleteHealthWorkerCommand extends DeleteCommand implements HealthWorkerCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Deletes the health worker identified by the index number used in the displayed health worker list.\n" + + "Parameters: INDEX (must be a positive integer)\n" + + "Example: " + COMMAND_WORD + " h 1\n"; + + public static final String MESSAGE_DELETE_HEALTHWORKER_SUCCESS = "Deleted Health Worker: %1$s"; + + public DeleteHealthWorkerCommand(Index index) { + super(index); + } + + @Override + public void delete(Model model, Object toDelete) { + model.deleteHealthWorker((HealthWorker) toDelete); + commitHealthWorkerBook(model); + //model.commitHealthWorkerBook(); + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + List lastShownList = model.getFilteredHealthWorkerList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + HealthWorker toDelete = lastShownList.get(index.getZeroBased()); + + if (model.isAssigned(toDelete.getNric().toString())) { + throw new CommandException(Messages.MESSAGE_HEALTHWORKER_ASSIGNED_CANNOT_DELETE); + } + + delete(model, toDelete); + return new CommandResult(String.format(MESSAGE_DELETE_HEALTHWORKER_SUCCESS, toDelete)); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof DeleteHealthWorkerCommand)) { + return false; + } + + return this.index.equals(((DeleteHealthWorkerCommand) other).index); + } +} diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 952a9e7e7f2b..1a92352ca604 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -1,228 +1,27 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; -import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; -import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; - -import seedu.address.commons.core.Messages; import seedu.address.commons.core.index.Index; -import seedu.address.commons.util.CollectionUtil; -import seedu.address.logic.CommandHistory; -import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; -import seedu.address.model.person.Address; -import seedu.address.model.person.Email; -import seedu.address.model.person.Name; -import seedu.address.model.person.Person; -import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; /** - * Edits the details of an existing person in the address book. + * Abstract class that represents to edit objects in the address book. + * @author Lookaz */ -public class EditCommand extends Command { +public abstract class EditCommand extends Command { public static final String COMMAND_WORD = "edit"; - - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified " - + "by the index number used in the displayed person list. " - + "Existing values will be overwritten by the input values.\n" - + "Parameters: INDEX (must be a positive integer) " - + "[" + PREFIX_NAME + "NAME] " - + "[" + PREFIX_PHONE + "PHONE] " - + "[" + PREFIX_EMAIL + "EMAIL] " - + "[" + PREFIX_ADDRESS + "ADDRESS] " - + "[" + PREFIX_TAG + "TAG]...\n" - + "Example: " + COMMAND_WORD + " 1 " - + PREFIX_PHONE + "91234567 " - + PREFIX_EMAIL + "johndoe@example.com"; - - public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; - public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book."; + public static final String MESSAGE_USAGE = "The different modes for editing an existing item are as follows:\n"; - private final Index index; - private final EditPersonDescriptor editPersonDescriptor; + protected final Index index; - /** - * @param index of the person in the filtered person list to edit - * @param editPersonDescriptor details to edit the person with - */ - public EditCommand(Index index, EditPersonDescriptor editPersonDescriptor) { + protected EditCommand(Index index) { requireNonNull(index); - requireNonNull(editPersonDescriptor); - this.index = index; - this.editPersonDescriptor = new EditPersonDescriptor(editPersonDescriptor); - } - - @Override - public CommandResult execute(Model model, CommandHistory history) throws CommandException { - requireNonNull(model); - List lastShownList = model.getFilteredPersonList(); - - if (index.getZeroBased() >= lastShownList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); - } - - Person personToEdit = lastShownList.get(index.getZeroBased()); - Person editedPerson = createEditedPerson(personToEdit, editPersonDescriptor); - - if (!personToEdit.isSamePerson(editedPerson) && model.hasPerson(editedPerson)) { - throw new CommandException(MESSAGE_DUPLICATE_PERSON); - } - - model.setPerson(personToEdit, editedPerson); - model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); - model.commitAddressBook(); - return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, editedPerson)); - } - - /** - * Creates and returns a {@code Person} with the details of {@code personToEdit} - * edited with {@code editPersonDescriptor}. - */ - private static Person createEditedPerson(Person personToEdit, EditPersonDescriptor editPersonDescriptor) { - assert personToEdit != null; - - Name updatedName = editPersonDescriptor.getName().orElse(personToEdit.getName()); - Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); - Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); - Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); - Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags); - } - - @Override - public boolean equals(Object other) { - // short circuit if same object - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof EditCommand)) { - return false; - } - - // state check - EditCommand e = (EditCommand) other; - return index.equals(e.index) - && editPersonDescriptor.equals(e.editPersonDescriptor); } - /** - * Stores the details to edit the person with. Each non-empty field value will replace the - * corresponding field value of the person. - */ - public static class EditPersonDescriptor { - private Name name; - private Phone phone; - private Email email; - private Address address; - private Set tags; - - public EditPersonDescriptor() {} - - /** - * Copy constructor. - * A defensive copy of {@code tags} is used internally. - */ - public EditPersonDescriptor(EditPersonDescriptor toCopy) { - setName(toCopy.name); - setPhone(toCopy.phone); - setEmail(toCopy.email); - setAddress(toCopy.address); - setTags(toCopy.tags); - } - - /** - * Returns true if at least one field is edited. - */ - public boolean isAnyFieldEdited() { - return CollectionUtil.isAnyNonNull(name, phone, email, address, tags); - } - - public void setName(Name name) { - this.name = name; - } - - public Optional getName() { - return Optional.ofNullable(name); - } - - public void setPhone(Phone phone) { - this.phone = phone; - } - - public Optional getPhone() { - return Optional.ofNullable(phone); - } - - public void setEmail(Email email) { - this.email = email; - } - - public Optional getEmail() { - return Optional.ofNullable(email); - } - - public void setAddress(Address address) { - this.address = address; - } - - public Optional
getAddress() { - return Optional.ofNullable(address); - } - - /** - * Sets {@code tags} to this object's {@code tags}. - * A defensive copy of {@code tags} is used internally. - */ - public void setTags(Set tags) { - this.tags = (tags != null) ? new HashSet<>(tags) : null; - } - - /** - * Returns an unmodifiable tag set, which throws {@code UnsupportedOperationException} - * if modification is attempted. - * Returns {@code Optional#empty()} if {@code tags} is null. - */ - public Optional> getTags() { - return (tags != null) ? Optional.of(Collections.unmodifiableSet(tags)) : Optional.empty(); - } - - @Override - public boolean equals(Object other) { - // short circuit if same object - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof EditPersonDescriptor)) { - return false; - } - - // state check - EditPersonDescriptor e = (EditPersonDescriptor) other; - - return getName().equals(e.getName()) - && getPhone().equals(e.getPhone()) - && getEmail().equals(e.getEmail()) - && getAddress().equals(e.getAddress()) - && getTags().equals(e.getTags()); - } - } + // abstract method to edit an object + public abstract void edit(Model model, Object toEdit, Object edited); } diff --git a/src/main/java/seedu/address/logic/commands/EditHealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/EditHealthWorkerCommand.java new file mode 100644 index 000000000000..a9ca313ef927 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/EditHealthWorkerCommand.java @@ -0,0 +1,206 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import java.util.List; +import java.util.Optional; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.commons.util.CollectionUtil; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.CommandType; +import seedu.address.model.Model; +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Phone; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.Organization; +import seedu.address.model.tag.Skills; + +/** + * @author Lookaz + * Edits the details of an existing HealthWorker object in the addressbook. + */ +public class EditHealthWorkerCommand extends EditCommand implements HealthWorkerCommand { + + public static final String MESSAGE_EDIT_HEALTHWORKER_SUCCESS = "Edited Health Worker: %1$s"; + + public static final String MESSAGE_USAGE = EditCommand.COMMAND_WORD + " " + COMMAND_OPTION + ": " + + "Edits the details health worker at the specified index number used in the displayed HealthWorker list " + + "Parameters: INDEX (must be a positive integer) " + EDIT_COMMAND_PARAMETERS + + "Example: " + EditCommand.COMMAND_WORD + ": " + EDIT_COMMAND_EXAMPLE; + + private final EditHealthWorkerDescriptor editHealthWorkerDescriptor; + + public EditHealthWorkerCommand(Index index, EditHealthWorkerDescriptor editHealthWorkerDescriptor) { + super(index); + requireNonNull(editHealthWorkerDescriptor); + + this.editHealthWorkerDescriptor = new EditHealthWorkerDescriptor(editHealthWorkerDescriptor); + } + + @Override + public void edit(Model model, Object toEdit, Object edited) { + model.setHealthWorker((HealthWorker) toEdit, (HealthWorker) edited); + model.updateFilteredHealthWorkerList(Model.PREDICATE_SHOW_ALL_HEALTHWORKERS); + commitHealthWorkerBook(model); + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + List lastShownList = model.getFilteredHealthWorkerList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + } + + HealthWorker toEdit = lastShownList.get(index.getZeroBased()); + HealthWorker edited = createEditedHealthWorker(toEdit, model, editHealthWorkerDescriptor); + + if (!toEdit.isSameHealthWorker(edited) && model.hasHealthWorker(edited)) { + throw new CommandException(DUPLICATE_HEALTH_WORKER); + } + + edit(model, toEdit, edited); + return new CommandResult(String.format(MESSAGE_EDIT_HEALTHWORKER_SUCCESS, edited)); + } + + /** + * Creates and returns a {@code HealthWorker} with the details of {@code toEdit} + * edited with {@code editHealthWorkerDescriptor}. + */ + private static HealthWorker createEditedHealthWorker(HealthWorker toEdit, Model model, + EditHealthWorkerDescriptor editHealthWorkerDescriptor) { + assert toEdit != null; + + Name updatedName = editHealthWorkerDescriptor.getName().orElse(toEdit.getName()); + Nric updatedNric = editHealthWorkerDescriptor.getNric().orElse(toEdit.getNric()); + if (editHealthWorkerDescriptor.getNric().isPresent()) { + editAssignedRequestHealthWorker(model, updatedNric.toString(), toEdit.getNric().toString()); + } + Phone updatedPhone = editHealthWorkerDescriptor.getPhone().orElse(toEdit.getPhone()); + Organization updatedOrganization = editHealthWorkerDescriptor.getOrganization() + .orElse(toEdit.getOrganization()); + Skills updatedSkills = editHealthWorkerDescriptor.getSkills().orElse(toEdit.getSkills()); + + return new HealthWorker(updatedName, updatedNric, updatedPhone, updatedOrganization, updatedSkills); + } + + /** + * Method that replaces all existence of old HealthWorker field in Request to the new HealthWorker upon editing + * the Name field of the HealthWorker. + */ + private static void editAssignedRequestHealthWorker(Model model, String newNric, String oldNric) { + model.updateRequestOnNameEdit(oldNric, newNric); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof EditHealthWorkerCommand)) { + return false; + } + + EditHealthWorkerCommand e = (EditHealthWorkerCommand) other; + return index.equals(e.index) && editHealthWorkerDescriptor.equals(e.editHealthWorkerDescriptor); + } + + /** + * Stores the details to edit the HealthWorker with. Each non-empty field value will replace the + * corresponding field value of the HealthWorker. + */ + public static class EditHealthWorkerDescriptor { + + protected Name name; + protected Nric nric; + protected Phone phone; + private Organization organization; + private Skills skills; + + + + public EditHealthWorkerDescriptor() {} + + public EditHealthWorkerDescriptor(EditHealthWorkerDescriptor toCopy) { + setName(toCopy.name); + setPhone(toCopy.phone); + setNric(toCopy.nric); + this.organization = toCopy.organization; + this.skills = toCopy.skills; + } + + public boolean isAnyFieldEdited() { + return CollectionUtil.isAnyNonNull(name, nric, phone, organization, skills); + } + + public void setName(Name name) { + this.name = name; + } + + public Optional getName() { + return Optional.ofNullable(name); + } + + public void setPhone(Phone phone) { + this.phone = phone; + } + + public Optional getPhone() { + return Optional.ofNullable(phone); + } + + public void setNric(Nric nric) { + this.nric = nric; + } + + public Optional getNric() { + return Optional.ofNullable(nric); + } + + public void setOrganization(Organization organization) { + this.organization = organization; + } + + public Optional getOrganization() { + return Optional.ofNullable(this.organization); + } + + public void setSkills(Skills skills) { + this.skills = skills; + } + + public Optional getSkills() { + return Optional.ofNullable(this.skills); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof EditHealthWorkerDescriptor)) { + return false; + } + + EditHealthWorkerDescriptor e = (EditHealthWorkerDescriptor) other; + + return getName().equals(e.getName()) + && getNric().equals(e.getNric()) + && getPhone().equals(e.getPhone()) + && getOrganization().equals(e.getOrganization()) + && getSkills().equals(e.getSkills()); + } + } + + @Override + public void commitHealthWorkerBook(Model model) { + model.commit(CommandType.HEALTHWORKER_AND_REQUEST_COMMAND); + } +} diff --git a/src/main/java/seedu/address/logic/commands/FilterCommand.java b/src/main/java/seedu/address/logic/commands/FilterCommand.java new file mode 100644 index 000000000000..25252fd7b298 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/FilterCommand.java @@ -0,0 +1,20 @@ +package seedu.address.logic.commands; + +import java.util.Collection; +import java.util.function.Predicate; + +import seedu.address.model.Model; + +/** + * Abstract class that represents a class with functionality to filter by a given predicate. + */ +public abstract class FilterCommand extends Command { + + public static final String COMMAND_WORD = "filter"; + public static final String INVALID_MESSAGE_FORMAT = "Filter command must contain at least 1 parameter.\n"; + + /** + * Method that filters a given list using the given predicate p. + */ + protected abstract void filter(Model model, Collection predicates); +} diff --git a/src/main/java/seedu/address/logic/commands/FilterHealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/FilterHealthWorkerCommand.java new file mode 100644 index 000000000000..f3ec04a3b888 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/FilterHealthWorkerCommand.java @@ -0,0 +1,60 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.function.Predicate; + +import seedu.address.commons.core.Messages; +import seedu.address.logic.CommandHistory; +import seedu.address.model.Model; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * @author Lookaz + * Finds and lists all persons in address book whose name contains any of the argument keywords. + * Keyword matching is case insensitive. + */ +public class FilterHealthWorkerCommand extends FilterCommand implements HealthWorkerCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + " " + COMMAND_OPTION + ": " + + "Parameters used to filter the current list of health workers by.\n" + + "Parameters: PARAMETER [MORE_PARAMETERS]...\n" + + "Example: " + COMMAND_WORD + " " + COMMAND_OPTION + " n/John"; + + private final List predicateList; + + public FilterHealthWorkerCommand(Collection predicates) { + this.predicateList = new ArrayList<>(predicates); + } + + @Override + public CommandResult execute(Model model, CommandHistory history) { + requireNonNull(model); + filter(model, predicateList); + return new CommandResult(String.format(Messages.MESSAGE_HEALTHWORKER_LISTED_OVERVIEW, + model.getFilteredHealthWorkerList().size())); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof FilterHealthWorkerCommand // instanceof handles nulls + && predicateList.equals(((FilterHealthWorkerCommand) other).predicateList)); // state check + } + + @Override + protected void filter(Model model, Collection predicates) { + Predicate predicate = reducePredicates(predicates); + model.updateFilteredHealthWorkerList(predicate); + } + + /** + * Method that reduces a collection of predicates in to a single predicate that fulfils all the predicates. + */ + public static Predicate reducePredicates(Collection predicates) { + return predicates.stream().reduce(x -> true, Predicate::and); + } +} diff --git a/src/main/java/seedu/address/logic/commands/FindCommand.java b/src/main/java/seedu/address/logic/commands/FindCommand.java deleted file mode 100644 index beb178e3a3f5..000000000000 --- a/src/main/java/seedu/address/logic/commands/FindCommand.java +++ /dev/null @@ -1,43 +0,0 @@ -package seedu.address.logic.commands; - -import static java.util.Objects.requireNonNull; - -import seedu.address.commons.core.Messages; -import seedu.address.logic.CommandHistory; -import seedu.address.model.Model; -import seedu.address.model.person.NameContainsKeywordsPredicate; - -/** - * Finds and lists all persons in address book whose name contains any of the argument keywords. - * Keyword matching is case insensitive. - */ -public class FindCommand extends Command { - - public static final String COMMAND_WORD = "find"; - - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain any of " - + "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n" - + "Parameters: KEYWORD [MORE_KEYWORDS]...\n" - + "Example: " + COMMAND_WORD + " alice bob charlie"; - - private final NameContainsKeywordsPredicate predicate; - - public FindCommand(NameContainsKeywordsPredicate predicate) { - this.predicate = predicate; - } - - @Override - public CommandResult execute(Model model, CommandHistory history) { - requireNonNull(model); - model.updateFilteredPersonList(predicate); - return new CommandResult( - String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size())); - } - - @Override - public boolean equals(Object other) { - return other == this // short circuit if same object - || (other instanceof FindCommand // instanceof handles nulls - && predicate.equals(((FindCommand) other).predicate)); // state check - } -} diff --git a/src/main/java/seedu/address/logic/commands/HealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/HealthWorkerCommand.java new file mode 100644 index 000000000000..a63a6656f29c --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/HealthWorkerCommand.java @@ -0,0 +1,49 @@ +package seedu.address.logic.commands; + +import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ORGANIZATION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_SKILLS; + +import seedu.address.model.CommandType; +import seedu.address.model.Model; +import seedu.address.model.tag.Specialisation; + +/** + * Interface that represents a Command object involving a HealthWorker + * @author Lookaz + */ +public interface HealthWorkerCommand { + + String COMMAND_OPTION = "healthworker/h/1"; + + String ADD_COMMAND_PARAMETERS = PREFIX_NAME + "NAME " + + PREFIX_NRIC + "NRIC " + + PREFIX_PHONE + "PHONE " + + PREFIX_ORGANIZATION + "ORGANIZATION " + + PREFIX_SKILLS + "SPECIALISATION..."; + + String ADD_COMMAND_EXAMPLE = PREFIX_NAME + "Dog Terr " + + PREFIX_NRIC + "S1234567A " + + PREFIX_PHONE + "98765432 " + + PREFIX_ORGANIZATION + "NUH " + + PREFIX_SKILLS + Specialisation.PHYSIOTHERAPY + " " + + Specialisation.GENERAL_PRACTICE; + + String EDIT_COMMAND_PARAMETERS = "[" + PREFIX_NAME + "NAME] " + + "[" + PREFIX_PHONE + "PHONE] " + + "[" + PREFIX_NRIC + "NRIC] " + + "[" + PREFIX_ORGANIZATION + "ORGANIZATION] " + + "[" + PREFIX_SKILLS + "SPECIALISATION]...\n"; + + String EDIT_COMMAND_EXAMPLE = PREFIX_NAME + "Pay Shun " + + PREFIX_PHONE + "88884444\n"; + + String DUPLICATE_HEALTH_WORKER = "This health worker " + + "already exists in the address book"; + + default void commitHealthWorkerBook(Model model) { + model.commit(CommandType.HEALTHWORKER_COMMAND); + } +} diff --git a/src/main/java/seedu/address/logic/commands/HistoryCommand.java b/src/main/java/seedu/address/logic/commands/HistoryCommand.java index dc3de1aad55e..a6d65582aea8 100644 --- a/src/main/java/seedu/address/logic/commands/HistoryCommand.java +++ b/src/main/java/seedu/address/logic/commands/HistoryCommand.java @@ -14,7 +14,7 @@ public class HistoryCommand extends Command { public static final String COMMAND_WORD = "history"; - public static final String MESSAGE_SUCCESS = "Entered commands (from most recent to earliest):\n%1$s"; + public static final String MESSAGE_SUCCESS = "Entered commands (from oldest to recent):\n%1$s"; public static final String MESSAGE_NO_HISTORY = "You have not yet entered any commands."; @Override diff --git a/src/main/java/seedu/address/logic/commands/ListCommand.java b/src/main/java/seedu/address/logic/commands/ListCommand.java index 6d44824c7d1b..4bc4d70a6197 100644 --- a/src/main/java/seedu/address/logic/commands/ListCommand.java +++ b/src/main/java/seedu/address/logic/commands/ListCommand.java @@ -1,25 +1,15 @@ package seedu.address.logic.commands; -import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; - -import seedu.address.logic.CommandHistory; -import seedu.address.model.Model; +import seedu.address.logic.commands.request.RequestCommand; /** - * Lists all persons in the address book to the user. + * Abstract class describing a command that involves listing objects. */ -public class ListCommand extends Command { +public abstract class ListCommand extends Command { public static final String COMMAND_WORD = "list"; - public static final String MESSAGE_SUCCESS = "Listed all persons"; - - - @Override - public CommandResult execute(Model model, CommandHistory history) { - requireNonNull(model); - model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); - return new CommandResult(MESSAGE_SUCCESS); - } + public static final String MESSAGE_USAGE = "The different modes for the list command are as follows:\n" + + COMMAND_WORD + " " + RequestCommand.COMMAND_OPTION + ": " + "Lists all existing requests.\n" + + COMMAND_WORD + " " + HealthWorkerCommand.COMMAND_OPTION + ": " + "Lists all existing health workers"; } diff --git a/src/main/java/seedu/address/logic/commands/ListCommandParser.java b/src/main/java/seedu/address/logic/commands/ListCommandParser.java new file mode 100644 index 000000000000..292bdd36fb1c --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/ListCommandParser.java @@ -0,0 +1,27 @@ +package seedu.address.logic.commands; + +import seedu.address.commons.core.Messages; +import seedu.address.logic.commands.request.ListRequestCommand; +import seedu.address.logic.parser.ArgumentTokenizer; +import seedu.address.logic.parser.CommandMode; +import seedu.address.logic.parser.Parser; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses the different modes for the list command and returns the respective list command. + */ +public class ListCommandParser implements Parser { + + @Override + public ListCommand parse(String userInput) throws ParseException { + CommandMode commandMode = ArgumentTokenizer.checkMode(userInput); + + if (commandMode == CommandMode.HEALTH_WORKER) { + return new ListHealthWorkerCommand(); + } else if (commandMode == CommandMode.REQUEST) { + return new ListRequestCommand(); + } + + throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ListCommand.MESSAGE_USAGE)); + } +} diff --git a/src/main/java/seedu/address/logic/commands/ListHealthWorkerCommand.java b/src/main/java/seedu/address/logic/commands/ListHealthWorkerCommand.java new file mode 100644 index 000000000000..ebfd7106c157 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/ListHealthWorkerCommand.java @@ -0,0 +1,27 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_HEALTHWORKERS; + +import seedu.address.logic.CommandHistory; +import seedu.address.model.Model; + +/** + * Lists all persons in the address book to the user. + */ +public class ListHealthWorkerCommand extends ListCommand implements HealthWorkerCommand { + + public static final String MESSAGE_SUCCESS = "Listed all health workers"; + + @Override + public CommandResult execute(Model model, CommandHistory history) { + requireNonNull(model); + model.updateFilteredHealthWorkerList(PREDICATE_SHOW_ALL_HEALTHWORKERS); + return new CommandResult(MESSAGE_SUCCESS); + } + + @Override + public boolean equals(Object obj) { + return obj == this || obj instanceof ListHealthWorkerCommand; + } +} diff --git a/src/main/java/seedu/address/logic/commands/RedoCommand.java b/src/main/java/seedu/address/logic/commands/RedoCommand.java index 227771a4eef6..122dc17429e1 100644 --- a/src/main/java/seedu/address/logic/commands/RedoCommand.java +++ b/src/main/java/seedu/address/logic/commands/RedoCommand.java @@ -1,7 +1,9 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; +import static seedu.address.logic.commands.Statistics.undoRedoStatistics; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_HEALTHWORKERS; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_REQUESTS; import seedu.address.logic.CommandHistory; import seedu.address.logic.commands.exceptions.CommandException; @@ -20,12 +22,16 @@ public class RedoCommand extends Command { public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); - if (!model.canRedoAddressBook()) { + if (!model.canRedo()) { throw new CommandException(MESSAGE_FAILURE); } - model.redoAddressBook(); - model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + model.redo(); + model.updateFilteredHealthWorkerList(PREDICATE_SHOW_ALL_HEALTHWORKERS); + model.updateFilteredRequestList(PREDICATE_SHOW_ALL_REQUESTS); + + undoRedoStatistics(model); + return new CommandResult(MESSAGE_SUCCESS); } } diff --git a/src/main/java/seedu/address/logic/commands/SelectCommand.java b/src/main/java/seedu/address/logic/commands/SelectCommand.java index baa3c1f30bb4..ba809fa92afa 100644 --- a/src/main/java/seedu/address/logic/commands/SelectCommand.java +++ b/src/main/java/seedu/address/logic/commands/SelectCommand.java @@ -9,21 +9,21 @@ import seedu.address.logic.CommandHistory; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.model.Model; -import seedu.address.model.person.Person; +import seedu.address.model.request.Request; /** - * Selects a person identified using it's displayed index from the address book. + * Selects a request identified using it's displayed index. */ public class SelectCommand extends Command { public static final String COMMAND_WORD = "select"; public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Selects the person identified by the index number used in the displayed person list.\n" + + ": Selects the request identified by the index number used in the displayed request list.\n" + "Parameters: INDEX (must be a positive integer)\n" + "Example: " + COMMAND_WORD + " 1"; - public static final String MESSAGE_SELECT_PERSON_SUCCESS = "Selected Person: %1$s"; + public static final String MESSAGE_SELECT_SUCCESS = "Selected Request: %1$s"; private final Index targetIndex; @@ -35,14 +35,14 @@ public SelectCommand(Index targetIndex) { public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); - List filteredPersonList = model.getFilteredPersonList(); + List filteredRequestList = model.getFilteredRequestList(); - if (targetIndex.getZeroBased() >= filteredPersonList.size()) { - throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); + if (targetIndex.getZeroBased() >= filteredRequestList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); } - model.setSelectedPerson(filteredPersonList.get(targetIndex.getZeroBased())); - return new CommandResult(String.format(MESSAGE_SELECT_PERSON_SUCCESS, targetIndex.getOneBased())); + model.setSelectedRequest(filteredRequestList.get(targetIndex.getZeroBased())); + return new CommandResult(String.format(MESSAGE_SELECT_SUCCESS, targetIndex.getOneBased())); } diff --git a/src/main/java/seedu/address/logic/commands/SetReminderCommand.java b/src/main/java/seedu/address/logic/commands/SetReminderCommand.java new file mode 100644 index 000000000000..35240a438025 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/SetReminderCommand.java @@ -0,0 +1,111 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import java.awt.Toolkit; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; + +import javafx.application.Platform; +import javafx.scene.control.Alert; +import javafx.scene.control.DialogPane; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.ui.InfoPanel; + +/** + * Sets a reminder to go off after adding hh:mm to current time. + */ +public class SetReminderCommand extends Command { + + public static final String COMMAND_WORD = "setreminder"; + public static final String INVALID_TIME_FORMAT = "Reminder should only be in t/ m/ format, with " + + "time consisting of only digits."; + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Sets a reminder to notify user after adding hh:mm:ss to the current time. \n" + + "Reminder only goes off during this session state. It will disappear after exiting the app. \n" + + "Example: " + COMMAND_WORD + " t/05:00:00 m/call patient Akshay for his request appointment."; + + public static final String MESSAGE_REMINDER_SUCCESS = "Set reminder to alert at: %1$s"; + + public static final SimpleDateFormat DISPLAY_FORMATTER = new SimpleDateFormat("dd MMMM YYYY, hh:mm:ss a"); + public static final SimpleDateFormat FORMATTER = new SimpleDateFormat("hh:mm:ss"); + private final String time; + private final String message; + private final Timer timer; + + public SetReminderCommand(String time, String message) { + this.time = time; + this.message = message; + this.timer = new Timer(); + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + try { + Date duration = FORMATTER.parse(time); + + Calendar c1 = Calendar.getInstance(); + Calendar c2 = dateToCalendar(duration); + Calendar cTotal = (Calendar) c1.clone(); + cTotal.add(Calendar.HOUR_OF_DAY, c2.get(Calendar.HOUR_OF_DAY)); + cTotal.add(Calendar.MINUTE, c2.get(Calendar.MINUTE)); + cTotal.add(Calendar.SECOND, c2.get(Calendar.SECOND)); + + //System.out.println("Action scheduled to perform at: " + DISPLAY_FORMATTER.format(cTotal.getTime())); + + timer.schedule(new TimerTask() { + @Override + public void run() { + Platform.runLater(() -> { + Alert reminderAlert = new Alert(Alert.AlertType.INFORMATION); + reminderAlert.setTitle("Reminder Alert"); + reminderAlert.setHeaderText("Health Hub Reminder Alert"); + reminderAlert.setContentText("This is an alert dialog to remind you to " + + message); + DialogPane dialogPane = reminderAlert.getDialogPane(); + dialogPane.getStylesheets().add(InfoPanel.STYLESHEET.toExternalForm()); + dialogPane.getStyleClass().add("alertDialog"); + Toolkit.getDefaultToolkit().beep(); + reminderAlert.showAndWait(); + }); + } + }, cTotal.getTime()); + + return new CommandResult(String.format(MESSAGE_REMINDER_SUCCESS, + DISPLAY_FORMATTER.format(cTotal.getTime()))); + + } catch (ParseException parseException) { + throw new CommandException("An unexpected error occurred!"); + } + } + + + /** + * Converts a {@code Date} object to a {@code Calendar} instance + * Reference: https://www.mkyong.com/java/java-convert-date-to-calendar-example/ + * @param date to be converted + * @return a Calendar instance + */ + public static Calendar dateToCalendar(Date date) { + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return calendar; + + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof SetReminderCommand // instanceof handles nulls + && time.equals(((SetReminderCommand) other).time)); // state check + } +} diff --git a/src/main/java/seedu/address/logic/commands/Statistics.java b/src/main/java/seedu/address/logic/commands/Statistics.java new file mode 100644 index 000000000000..8871e3f42c01 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/Statistics.java @@ -0,0 +1,124 @@ +package seedu.address.logic.commands; + +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; + +import javafx.collections.ObservableList; +import seedu.address.model.Model; +import seedu.address.model.ReadOnlyRequestBook; +import seedu.address.model.request.Request; +import seedu.address.model.tag.Condition; + +/** + * Class that represents a TreeMap of conditions and their respective occurences + */ +public class Statistics { + + private static final String MESSAGE_EMPTY_STATISTICS = "Conditions and their related occurences are not available"; + + //statistics will be ordering health conditions by key + private static Map statistics = new TreeMap<>(); + + //sortedMap will be ordering the health conditions by their corresponding number of occurrences + private static Map sortedMap = new LinkedHashMap<>(); + + /** + * Returns the number of times the specific condition has appeared in added requests + * + * @param condition to check for. + * @return number of condition occurences in the map + */ + public static Integer getConditionStatistics(Condition condition) { + return statistics.getOrDefault(condition.toString().toUpperCase(), 0); + } + + /** + * Clears records on both statistics and sortedMap + */ + public static void clearStatistics() { + statistics.clear(); + sortedMap.clear(); + } + + /** + * Updates statistics tree map every time a new request is deleted + * the integer value pegged to the toBeDeleted Condition will be reduced + * + * @param conditionSet to check for. + */ + public static void deleteStatistics(Set conditionSet) { + for (Condition condition : conditionSet) { + String conditionName = condition.toString().toUpperCase(); + Integer count = statistics.get(conditionName); + statistics.put(conditionName, count - 1); + if (getConditionStatistics(condition) == 0) { + statistics.remove(conditionName); + } + } + sortStatistics(); + } + + /** + * Updates statistics tree map every time a new request is added + * If it is a new condition, a new entry in the tree map will be made + * Else, the integer value will be incremented + * + * @param conditionSet to check for. + */ + public static void updateStatistics(Set conditionSet) { + for (Condition condition : conditionSet) { + String conditionName = condition.toString().toUpperCase(); + Integer count = statistics.get(conditionName); + statistics.put(conditionName, (count == null) ? 1 : count + 1); + } + sortStatistics(); + } + + /** + * Sorts statistics tree map in reverse order of value (Key: condition name, + * Value: number of occurrences) -> condition with highest incidence rate will + * appear at the top of the outputted list + */ + public static void sortStatistics() { + sortedMap.clear(); + statistics.entrySet() + .stream() + .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) + .forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue())); + } + + /** + * Integrated method with Undo/Redo commands. Takes an ObservableList of all + * requests and extracts health conditions from each request. updateStatistics is then + * called to modify statistics to the current state of requests + */ + public static void undoRedoStatistics(Model model) { + ReadOnlyRequestBook requestBook = model.getRequestBook(); + ObservableList requestList = requestBook.getRequestList(); + clearStatistics(); + for (Request request : requestList) { + Set conditionSet = request.getConditions(); + updateStatistics(conditionSet); + } + sortStatistics(); + } + + /** + * Displays all conditions in a standard format + */ + public static String toCommand() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("Conditions and Occurences:\n"); + if (statistics.isEmpty()) { + return MESSAGE_EMPTY_STATISTICS; + } + for (Map.Entry statistic : sortedMap.entrySet()) { + stringBuilder.append(statistic.getKey()) + .append(": ").append(statistic.getValue()).append(" occurences\n"); + } + return stringBuilder.toString(); + } +} diff --git a/src/main/java/seedu/address/logic/commands/StatisticsCommand.java b/src/main/java/seedu/address/logic/commands/StatisticsCommand.java new file mode 100644 index 000000000000..74960b5abc46 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/StatisticsCommand.java @@ -0,0 +1,24 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import seedu.address.logic.CommandHistory; +import seedu.address.model.Model; + +/** + * Format statistics of existing conitions in the request book . + */ +public class StatisticsCommand extends Command { + + public static final String COMMAND_WORD = "statistics"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows the conditions existent in " + + "the request book and the number of occurences of each condition. Formatted from most common" + + "to least common health condition"; + + @Override + public CommandResult execute(Model model, CommandHistory history) { + requireNonNull(model); + return new CommandResult(Statistics.toCommand()); + } +} diff --git a/src/main/java/seedu/address/logic/commands/UndoCommand.java b/src/main/java/seedu/address/logic/commands/UndoCommand.java index 40441264f346..07bcb5785aac 100644 --- a/src/main/java/seedu/address/logic/commands/UndoCommand.java +++ b/src/main/java/seedu/address/logic/commands/UndoCommand.java @@ -1,7 +1,9 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; -import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; +import static seedu.address.logic.commands.Statistics.undoRedoStatistics; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_HEALTHWORKERS; +import static seedu.address.model.Model.PREDICATE_SHOW_ALL_REQUESTS; import seedu.address.logic.CommandHistory; import seedu.address.logic.commands.exceptions.CommandException; @@ -20,12 +22,16 @@ public class UndoCommand extends Command { public CommandResult execute(Model model, CommandHistory history) throws CommandException { requireNonNull(model); - if (!model.canUndoAddressBook()) { + if (!model.canUndo()) { throw new CommandException(MESSAGE_FAILURE); } - model.undoAddressBook(); - model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + model.undo(); + model.updateFilteredHealthWorkerList(PREDICATE_SHOW_ALL_HEALTHWORKERS); + model.updateFilteredRequestList(PREDICATE_SHOW_ALL_REQUESTS); + + undoRedoStatistics(model); + return new CommandResult(MESSAGE_SUCCESS); } } diff --git a/src/main/java/seedu/address/logic/commands/request/AddRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/AddRequestCommand.java new file mode 100644 index 000000000000..6b8efe6beeaa --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/AddRequestCommand.java @@ -0,0 +1,70 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.AddCommand; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.Statistics; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.request.Request; + +/** + * Creates a new request to the request book. + * + * @@author daviddl9 + */ +public class AddRequestCommand extends AddCommand implements RequestCommand { + + public static final String COMMAND_WORD = "add"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Creates a new request in the request book.\n" + "Parameters: " + + ADD_COMMAND_PARAMETERS + + "Example: " + COMMAND_WORD + " " + COMMAND_OPTION + " " + + ADD_COMMAND_EXAMPLE; + + public static final String MESSAGE_SUCCESS = "Created new request successfully: %1$s"; + + private final Request newRequest; + + public AddRequestCommand(Request newRequest) { + requireNonNull(newRequest); + this.newRequest = newRequest; + } + + /** + * Executes the command and returns the result message. + * + * @param model {@code Model} which the command should operate on. + * @param history {@code CommandHistory} which the command should operate on. + * @return feedback message of the operation result for display + * @throws CommandException If an error occurs during command execution. + */ + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + if (model.hasRequest(this.newRequest)) { + throw new CommandException(MESSAGE_DUPLICATE_REQUEST); + } + model.addRequest(newRequest); + //model.commitRequestBook(); + commitRequestBook(model); + Statistics.updateStatistics(newRequest.getConditions()); + return new CommandResult(String.format(MESSAGE_SUCCESS, newRequest)); + } + + @Override + public void add(Model model, Object toAdd) { + model.addRequest((Request) toAdd); + model.commitRequestBook(); + } + + @Override + public boolean equals(Object other) { + return other == this + || (other instanceof AddRequestCommand + && newRequest.isSameRequest(((AddRequestCommand) other).newRequest)); + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/AssignRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/AssignRequestCommand.java new file mode 100644 index 000000000000..1a7791116276 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/AssignRequestCommand.java @@ -0,0 +1,159 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import static seedu.address.logic.parser.CliSyntax.PREFIX_HEALTHWORKER; +import static seedu.address.logic.parser.CliSyntax.PREFIX_REQUEST; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.StringJoiner; +import java.util.TreeSet; +import java.util.logging.Logger; + +import seedu.address.commons.core.LogsCenter; +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.Command; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.request.Request; + +/** + * Assigns multiple requests to a HealthWorker with two way association. + */ +public class AssignRequestCommand extends Command implements RequestCommand { + + public static final String COMMAND_WORD = "assign"; + + public static final int MIN_REQUEST_DURATION = 2; // buffer between requests should be at + // least 2 hours + + public static final String MESSAGE_SUCCESS = "Assigned request %1$s successfully to healthworker %2$s"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Assign requests to healthworker. " + + "Parameters: " + + PREFIX_HEALTHWORKER + "HEALTHWORKER_ID " + + PREFIX_REQUEST + "REQUEST_ID \n" + + "Example: " + COMMAND_WORD + " " + + PREFIX_HEALTHWORKER + "1 " + + PREFIX_REQUEST + "1 " + PREFIX_REQUEST + "3"; + + private static final Logger logger = LogsCenter.getLogger(AssignRequestCommand.class); + + private final Index healthworkerId; + private final Set requestIds; + + /** + * Creates an assign request command to assign requests to a {@code HealthWorker} + */ + public AssignRequestCommand(Index healthworkerId, Set requestIds) { + requireAllNonNull(healthworkerId, requestIds); + this.healthworkerId = healthworkerId; + this.requestIds = requestIds; + } + + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + List lastShownHealthworkerList = model.getFilteredHealthWorkerList(); + List lastShownRequestList = model.getFilteredRequestList(); + Set requestsToAdd = new HashSet<>(); + + if (healthworkerId.getZeroBased() >= lastShownHealthworkerList.size()) { + logger.warning("Invalid healthworker index " + healthworkerId.getOneBased() + + " accessed for assign"); + throw new CommandException(Messages.MESSAGE_INVALID_HEALTHWORKER_DISPLAYED_INDEX); + } + + HealthWorker healthWorkerToAssign = + lastShownHealthworkerList.get(healthworkerId.getZeroBased()); + + for (Index i : requestIds) { + if (i.getZeroBased() >= lastShownRequestList.size()) { + logger.warning("Invalid request index " + healthworkerId.getOneBased() + + " accessed for assign"); + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); + } + + Request request = lastShownRequestList.get(i.getZeroBased()); + if (request.isCompleted()) { + logger.info("Error: attempted to assign to a completed request at index " + i.getOneBased()); + throw new CommandException(Messages.MESSAGE_REQUEST_COMPLETED_CANNOT_ASSIGN); + } + requestsToAdd.add(request); + } + + HealthWorker assignedHealthWorker = new HealthWorker(healthWorkerToAssign); + + // First, adds all the date and time that the current healthworker is assigned to + TreeSet healthWorkerAppointments = new TreeSet<>(); + + for (Request req : lastShownRequestList) { + if (assignedHealthWorker.getNric().toString().equals(req.getHealthStaff()) && req.isOngoingStatus()) { + healthWorkerAppointments.add(req.getRequestDate().getDate()); + } + } + + Calendar calendar = Calendar.getInstance(); + + for (Request request : requestsToAdd) { + + if (healthWorkerToAssign.getNric().toString().equals(request.getHealthStaff())) { + throw new CommandException(Messages.MESSAGE_HEALTHWORKER_ALREADY_ASSIGNED); + } + + Date date = request.getRequestDate().getDate(); + calendar.setTime(date); + calendar.add(Calendar.HOUR_OF_DAY, -MIN_REQUEST_DURATION); + Date lowerLimit = calendar.getTime(); + logger.info("Lower limit: " + lowerLimit); + calendar.add(Calendar.HOUR_OF_DAY, 2 * MIN_REQUEST_DURATION); + Date upperLimit = calendar.getTime(); + logger.info("Upper limit: " + upperLimit); + + if (healthWorkerAppointments.contains(date) || (healthWorkerAppointments.lower(date) != null + && healthWorkerAppointments.lower(date).after(lowerLimit)) + || (healthWorkerAppointments.higher(date) != null + && healthWorkerAppointments.ceiling(date).before(upperLimit))) { + throw new CommandException(Messages.MESSAGE_HEALTHWORKER_OCCUPIED_CANNOT_ASSIGN); + } + + healthWorkerAppointments.add(date); + + } + + for (Request request : requestsToAdd) { + Request updatedRequest = new Request(request); + updatedRequest.setHealthWorker(assignedHealthWorker); + model.updateRequest(request, updatedRequest); + } + + model.updateFilteredRequestList(Model.PREDICATE_SHOW_ALL_REQUESTS); + commitRequestBook(model); + + StringJoiner sj = new StringJoiner(", "); + for (Index i : requestIds) { + sj.add(Integer.toString(i.getOneBased())); + } + + return new CommandResult(String.format(MESSAGE_SUCCESS, sj.toString(), + assignedHealthWorker)); + + } + + @Override + public boolean equals(Object other) { + return other == this + || (other instanceof AssignRequestCommand + && healthworkerId.equals(((AssignRequestCommand) other).healthworkerId) + && requestIds.equals(((AssignRequestCommand) other).requestIds)); + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/ClearRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/ClearRequestCommand.java new file mode 100644 index 000000000000..083622d84b50 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/ClearRequestCommand.java @@ -0,0 +1,41 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import seedu.address.commons.core.Messages; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.Command; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.Statistics; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.RequestBook; +import seedu.address.model.request.Request; + +/** + * Clears the request book. + * + * @@author daviddl9 + */ +public class ClearRequestCommand extends Command implements RequestCommand { + + public static final String COMMAND_WORD = "clr"; + public static final String MESSAGE_SUCCESS = "Request book has been cleared!"; + + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + for (Request request : model.getRequestBook().getRequestList()) { + if (request.isOngoingStatus()) { + throw new CommandException(Messages.MESSAGE_REQUEST_ONGOING_CANNOT_CLEAR); + } + } + model.resetData(new RequestBook()); + Statistics.clearStatistics(); + //model.commitRequestBook(); + commitRequestBook(model); + + return new CommandResult(MESSAGE_SUCCESS); + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/CompleteRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/CompleteRequestCommand.java new file mode 100644 index 000000000000..57ef185b3826 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/CompleteRequestCommand.java @@ -0,0 +1,72 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.Command; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestStatus; + +/** + * Marks a request as COMPLETED. + * + * @@author daviddl9 + */ +public class CompleteRequestCommand extends Command implements RequestCommand { + + public static final String COMMAND_WORD = "complete"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Marks an request as COMPLETED \n" + + "Parameters: INDEX (must be a positive integer) \n" + + "Example: " + COMMAND_WORD + " 1 "; + + + public static final String MESSAGE_COMPLETED_REQUEST_SUCCESS = "Request %1$s have been completed."; + public static final String MESSAGE_ONGOING_REQUEST = "Only ONGOING status can be marked as completed."; + + private final Index targetIndex; + + public CompleteRequestCommand(Index targetIndex) { + this.targetIndex = targetIndex; + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + List lastShownList = model.getFilteredRequestList(); + + if (targetIndex.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); + } + + Request requestToBeCompleted = lastShownList.get(targetIndex.getZeroBased()); + Request completedRequest = new Request(requestToBeCompleted); + if (!requestToBeCompleted.getRequestStatus().equals(new RequestStatus("ONGOING"))) { + throw new CommandException(MESSAGE_ONGOING_REQUEST); + } + + completedRequest.complete(); + + model.updateRequest(requestToBeCompleted, completedRequest); + model.updateFilteredRequestList(Model.PREDICATE_SHOW_ALL_REQUESTS); + commitRequestBook(model); + + return new CommandResult(String.format(MESSAGE_COMPLETED_REQUEST_SUCCESS, completedRequest)); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof CompleteRequestCommand // instanceof handles nulls + && targetIndex.equals(((CompleteRequestCommand) other).targetIndex)); // state check + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/DeleteRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/DeleteRequestCommand.java new file mode 100644 index 000000000000..3554905132a4 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/DeleteRequestCommand.java @@ -0,0 +1,63 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.DeleteCommand; +import seedu.address.logic.commands.Statistics; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.request.Request; + +/** + * Deletes a request identified using it's displayed index from the request book. + * + * @@author daviddl9 + */ +public class DeleteRequestCommand extends DeleteCommand implements RequestCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Deletes the request identified " + + "by the index number used in the displayed request list.\n" + + "Parameters: INDEX (must be a positive integer)\n" + + "Example: " + COMMAND_WORD + " request 1"; + + public static final String MESSAGE_DELETE_REQUEST_SUCCESS = "Deleted Request: %1$s"; + + public DeleteRequestCommand(Index targetIndex) { + super(targetIndex); + } + + @Override + public void delete(Model model, Object toDelete) { + model.deleteRequest((Request) toDelete); + //model.commitRequestBook(); + commitRequestBook(model); + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + List lastShownList = model.getFilteredRequestList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); + } + + Request requestToDelete = lastShownList.get(index.getZeroBased()); + Statistics.deleteStatistics(requestToDelete.getConditions()); + delete(model, requestToDelete); + return new CommandResult(String.format(MESSAGE_DELETE_REQUEST_SUCCESS, requestToDelete)); + } + + @Override + public boolean equals(Object other) { + return other == this || (other instanceof DeleteRequestCommand + && index.equals(((DeleteRequestCommand) other).index)); + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/EditRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/EditRequestCommand.java new file mode 100644 index 000000000000..70f0d9c28e2d --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/EditRequestCommand.java @@ -0,0 +1,314 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.TreeSet; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.commons.util.CollectionUtil; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.EditCommand; +import seedu.address.logic.commands.Statistics; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.person.Address; +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Phone; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestDate; +import seedu.address.model.request.RequestStatus; +import seedu.address.model.tag.Condition; + +/** + * Edits an order in the request book. + * + * @@author daviddl9 + */ +public class EditRequestCommand extends EditCommand implements RequestCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + " " + COMMAND_OPTION + + ": Edits the details of the order identified " + + "by the index number used in the displayed request book. " + + "Existing values will be overwritten by the input values.\n" + + "Parameters: INDEX (must be a positive integer) " + + EDIT_COMMAND_PARAMETERS + + "Example: " + COMMAND_WORD + " " + COMMAND_OPTION + " " + + EDIT_COMMAND_EXAMPLE; + + public static final String MESSAGE_EDIT_REQUEST_SUCCESS = "Edited Request: %1$s"; + + public static final int MIN_REQUEST_DURATION = 2; + + private final EditRequestDescriptor editRequestDescriptor; + + /** + * @param index of the request in the filtered request list to edit + * @param editRequestDescriptor details to edit the request with + */ + public EditRequestCommand(Index index, EditRequestDescriptor editRequestDescriptor) { + super(index); + requireNonNull(editRequestDescriptor); + + this.editRequestDescriptor = new EditRequestDescriptor(editRequestDescriptor); + } + + /** + * Creates and returns a {@code Request} with the details of {@code requestToEdit} + * edited with {@code editRequestDescriptor}. + */ + private static Request createEditedRequest(Request requestToEdit, + EditRequestDescriptor editRequestDescriptor, + Model model) throws CommandException { + assert requestToEdit != null; + Name updatedName = editRequestDescriptor.getName().orElse(requestToEdit.getName()); + Phone updatedPhone = editRequestDescriptor.getPhone().orElse(requestToEdit.getPhone()); + Address updatedAddress = editRequestDescriptor.getAddress().orElse(requestToEdit.getAddress()); + RequestDate updatedRequestDate = editRequestDescriptor.getDate().orElse(requestToEdit.getRequestDate()); + if (editRequestDescriptor.getDate().isPresent()) { + Calendar calendar = Calendar.getInstance(); + + TreeSet healthWorkerDates = new TreeSet<>(); + + String updatedHealthWorker; + if (editRequestDescriptor.getHealthWorker().isPresent()) { + updatedHealthWorker = editRequestDescriptor.getHealthWorker().toString(); + } else { + updatedHealthWorker = requestToEdit.getHealthStaff(); + } + + for (Request request : model.getFilteredRequestList()) { + if (updatedHealthWorker != null && updatedHealthWorker.equals(request.getHealthStaff())) { + healthWorkerDates.add(request.getRequestDate().getDate()); + } + } + + Date date = updatedRequestDate.getDate(); + calendar.setTime(date); + calendar.add(Calendar.HOUR_OF_DAY, -MIN_REQUEST_DURATION); + Date lowerLimit = calendar.getTime(); + calendar.add(Calendar.HOUR_OF_DAY, 2 * MIN_REQUEST_DURATION); + Date upperLimit = calendar.getTime(); + + if (healthWorkerDates.contains(date) || (healthWorkerDates.lower(date) != null && healthWorkerDates + .lower(date).after(lowerLimit)) + || (healthWorkerDates.higher(date) != null && healthWorkerDates.ceiling(date).before(upperLimit))) { + throw new CommandException(Messages.MESSAGE_EDITED_TIME_HEALTHWORKER_UNAVAILABLE); + } + } + Nric updatedNric = editRequestDescriptor.getNric().orElse(requestToEdit.getNric()); + RequestStatus updatedRequestStatus = + editRequestDescriptor.getRequestStatus().orElse(requestToEdit.getRequestStatus()); + Set updatedConditions = editRequestDescriptor.getConditions().orElse(requestToEdit + .getConditions()); + String updatedHealthWorker; + if (requestToEdit.getHealthStaff() != null && !updatedRequestStatus.equals(new RequestStatus("PENDING"))) { + updatedHealthWorker = requestToEdit.getHealthStaff(); + } else { + updatedHealthWorker = null; + } + + if (updatedHealthWorker == null) { + return new Request(updatedName, updatedNric, updatedPhone, updatedAddress, + updatedRequestDate, updatedConditions, updatedRequestStatus); + } else { + return new Request(updatedName, updatedNric, updatedPhone, updatedAddress, + updatedRequestDate, updatedConditions, updatedRequestStatus, updatedHealthWorker); + } + + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireAllNonNull(model, history); + List lastShownList = model.getFilteredRequestList(); + + if (index.getZeroBased() >= lastShownList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); + } + + Request requestToEdit = lastShownList.get(index.getZeroBased()); + Request editedRequest = createEditedRequest(requestToEdit, editRequestDescriptor, model); + + if (!requestToEdit.isSameRequest(editedRequest) && model.hasRequest(editedRequest)) { + throw new CommandException(MESSAGE_DUPLICATE_REQUEST); + } + + Statistics.deleteStatistics(requestToEdit.getConditions()); + Statistics.updateStatistics(editedRequest.getConditions()); + + edit(model, requestToEdit, editedRequest); + return new CommandResult(String.format(MESSAGE_EDIT_REQUEST_SUCCESS, editedRequest)); + // List lastShownList = model.getF() + } + + @Override + public void edit(Model model, Object toEdit, Object edited) { + model.setRequest((Request) toEdit, (Request) edited); + model.updateFilteredRequestList(Model.PREDICATE_SHOW_ALL_REQUESTS); + commitRequestBook(model); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof EditRequestCommand)) { + return false; + } + + EditRequestCommand e = (EditRequestCommand) other; + return index.equals(e.index) && editRequestDescriptor.equals(((EditRequestCommand) other) + .editRequestDescriptor); + } + + /** + * Stores the details to edit the request with. Each non-empty field value will replace the + * corresponding field value of the order. + */ + public static class EditRequestDescriptor { + private Name name; + private Phone phone; + private Address address; + private RequestDate requestDate; + private Nric nric; + private Set conditions; + private String healthWorker; + private RequestStatus requestStatus; + + public EditRequestDescriptor() {} + + /** + * Copy constructor. + * A defensive copy of {@code request} is used internally. + */ + public EditRequestDescriptor(EditRequestDescriptor toCopy) { + setName(toCopy.name); + setPhone(toCopy.phone); + setAddress(toCopy.address); + setDate(toCopy.requestDate); + setNric(toCopy.nric); + setConditions(toCopy.conditions); + setHealthWorker(toCopy.healthWorker); + setRequestStatus(toCopy.requestStatus); + } + + /** + * Returns true if at least one field is edited. + */ + public boolean isAnyFieldEdited() { + return CollectionUtil.isAnyNonNull(name, nric, phone, address, requestDate, + conditions, requestStatus); + } + + public Optional getRequestStatus() { + return Optional.ofNullable(requestStatus); + } + + public void setRequestStatus(RequestStatus requestStatus) { + this.requestStatus = requestStatus; + } + + public Optional getName() { + return Optional.ofNullable(name); + } + + public void setName(Name name) { + this.name = name; + } + + public Optional getPhone() { + return Optional.ofNullable(phone); + } + + public void setPhone(Phone phone) { + this.phone = phone; + } + + public Optional
getAddress() { + return Optional.ofNullable(address); + } + + public void setAddress(Address address) { + this.address = address; + } + + public Optional getDate() { + return Optional.ofNullable(requestDate); + } + + public void setDate(RequestDate requestDate) { + this.requestDate = requestDate; + } + + public Optional getNric() { + return Optional.ofNullable(nric); + } + + public void setNric(Nric nric) { + this.nric = nric; + } + + public Optional getHealthWorker() { + return Optional.ofNullable(healthWorker); + } + + public void setHealthWorker(String healthWorker) { + this.healthWorker = healthWorker; + } + + /** + * Returns an unmodifiable condition set, which throws {@code UnsupportedOperationException} + * if modification is attempted. + * Returns {@code Optional#empty()} if {@code conditions} is null + */ + public Optional> getConditions() { + return (conditions != null) ? Optional.of(Collections.unmodifiableSet(conditions)) + : Optional.empty(); + } + + /** + * Sets {@code conditions} to this object's {@code conditions} + * A defensive copy of {@code conditions} is used internally. + */ + public void setConditions(Set conditions) { + this.conditions = (conditions != null) ? new HashSet<>(conditions) : null; + } + + @Override + public boolean equals(Object other) { + // short circuit if same object + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof EditRequestDescriptor)) { + return false; + } + + // state check + EditRequestDescriptor editRequestDescriptor = (EditRequestDescriptor) other; + + return getName().equals(editRequestDescriptor.getName()) + && getPhone().equals(editRequestDescriptor.getPhone()) + && getNric().equals(editRequestDescriptor.getNric()) + && getAddress().equals(editRequestDescriptor.getAddress()) + && getDate().equals(editRequestDescriptor.getDate()) + && getConditions().equals(editRequestDescriptor.getConditions()) + && getHealthWorker().equals(editRequestDescriptor.getHealthWorker()); + } + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/FilterRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/FilterRequestCommand.java new file mode 100644 index 000000000000..bde2080c19f8 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/FilterRequestCommand.java @@ -0,0 +1,57 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import java.util.Arrays; +import java.util.Collection; +import java.util.function.Predicate; + +import seedu.address.commons.core.Messages; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.FilterCommand; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.request.Request; + +/** + * Finds and lists all requests in request book whose name contains any of the argument keywords. + * Keyword matching is case sensitive. + * + * @@author daviddl9 + */ +public class FilterRequestCommand extends FilterCommand implements RequestCommand { + + public static final String MESSAGE_USAGE = COMMAND_WORD + " " + COMMAND_OPTION + ": Finds all requests " + + "whose names contain any of the specified keywords (case-sensitive) and displays them as a " + + "list with index numbers. \n" + + "Parameters: KEYWORD [MORE_KEYWORDS]...\n" + + "Example: " + COMMAND_WORD + " " + COMMAND_OPTION + " n/alice n/bob n/charlie"; + + private final Predicate predicate; + + public FilterRequestCommand(Predicate predicate) { + this.predicate = predicate; + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + filter(model, Arrays.asList(predicate)); + return new CommandResult(String.format(Messages.MESSAGE_REQUESTS_LISTED_OVERVIEW, + model.getFilteredRequestList().size())); + } + + @Override + protected void filter(Model model, Collection predicates) { + model.updateFilteredRequestList(predicate); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof FilterRequestCommand) // instanceof handles nulls + && predicate.equals(((FilterRequestCommand) other).predicate); + } + +} diff --git a/src/main/java/seedu/address/logic/commands/request/ListRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/ListRequestCommand.java new file mode 100644 index 000000000000..d0950882463b --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/ListRequestCommand.java @@ -0,0 +1,30 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.ListCommand; +import seedu.address.model.Model; + +/** + * Lists all requests in the request book to the user. + */ +public class ListRequestCommand extends ListCommand implements RequestCommand { + + public static final String MESSAGE_SUCCESS = "Listed all requests"; + + public static final String COMMAND_WORD = "lr"; + + @Override + public CommandResult execute(Model model, CommandHistory history) { + requireNonNull(model); + model.updateFilteredRequestList(Model.PREDICATE_SHOW_ALL_REQUESTS); + return new CommandResult(MESSAGE_SUCCESS); + } + + @Override + public boolean equals(Object obj) { + return obj == this || obj instanceof ListRequestCommand; + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/RequestCommand.java b/src/main/java/seedu/address/logic/commands/request/RequestCommand.java new file mode 100644 index 000000000000..4f563b30be54 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/RequestCommand.java @@ -0,0 +1,56 @@ +package seedu.address.logic.commands.request; + +import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.PREFIX_CONDITION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; +import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS; + +import seedu.address.model.CommandType; +import seedu.address.model.Model; + +/** + * Interface that represents a command involving a request + * + * @@author daviddl9 + */ +public interface RequestCommand { + + String COMMAND_OPTION = "request"; + + String ADD_COMMAND_PARAMETERS = PREFIX_NAME + "NAME " + + PREFIX_NRIC + "NRIC " + + PREFIX_PHONE + "PHONE " + + PREFIX_ADDRESS + "ADDRESS " + + PREFIX_DATE + "DATETIME " + + PREFIX_CONDITION + "CONDITION...\n"; + + String ADD_COMMAND_EXAMPLE = PREFIX_NAME + "John Doe " + + PREFIX_PHONE + "81234567 " + + PREFIX_NRIC + "S9123456A " + + PREFIX_ADDRESS + "123, Sengkang Ave 3, #04-12, 214632 " + + PREFIX_DATE + "01-01-2019 08:00:00 " + + PREFIX_CONDITION + "Physiotherapy"; + + String EDIT_COMMAND_PARAMETERS = "[" + PREFIX_NAME + "NAME] " + + "[" + PREFIX_PHONE + "PHONE] " + + "[" + PREFIX_ADDRESS + "ADDRESS] " + + "[" + PREFIX_DATE + "DATE] " + + "[" + PREFIX_STATUS + "STATUS] " + + "[" + PREFIX_NRIC + "NRIC] " + + "[" + PREFIX_CONDITION + "CONDITION]...\n" + + "Note that the date format is dd-mm-yyyy HH:mm:ss in 24hour format.\n"; + + String EDIT_COMMAND_EXAMPLE = PREFIX_PHONE + "91234567 " + + PREFIX_CONDITION + "Physiotherapy " + + PREFIX_CONDITION + "Dialysis"; + + String MESSAGE_DUPLICATE_REQUEST = "This request already exists in the " + + "request book."; + + default void commitRequestBook(Model model) { + model.commit(CommandType.REQUEST_COMMAND); + } +} diff --git a/src/main/java/seedu/address/logic/commands/request/SelectRequestCommand.java b/src/main/java/seedu/address/logic/commands/request/SelectRequestCommand.java new file mode 100644 index 000000000000..ba08994be3bb --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/request/SelectRequestCommand.java @@ -0,0 +1,58 @@ +package seedu.address.logic.commands.request; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import seedu.address.commons.core.Messages; +import seedu.address.commons.core.index.Index; +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.Command; +import seedu.address.logic.commands.CommandResult; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; +import seedu.address.model.request.Request; + +/** + * Selects a request identified using it's displayed index from the request book. + */ +public class SelectRequestCommand extends Command { + + public static final String COMMAND_WORD = "sr"; + + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Selects the request identified by the index number used in the displayed request " + + "list.\n" + + "Parameters: INDEX (must be a positive integer)\n" + + "Example: " + COMMAND_WORD + " 1"; + + public static final String MESSAGE_SELECT_REQUEST_SUCCESS = "Selected Request: %1$s"; + + private final Index targetIndex; + + public SelectRequestCommand(Index targetIndex) { + this.targetIndex = targetIndex; + } + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + requireNonNull(model); + + List filteredRequestList = model.getFilteredRequestList(); + + if (targetIndex.getZeroBased() >= filteredRequestList.size()) { + throw new CommandException(Messages.MESSAGE_INVALID_REQUEST_DISPLAYED_INDEX); + } + + model.setSelectedRequest(filteredRequestList.get(targetIndex.getZeroBased())); + return new CommandResult(String.format(MESSAGE_SELECT_REQUEST_SUCCESS, + targetIndex.getOneBased())); + } + + @Override + public boolean equals(Object other) { + return other == this + || (other instanceof SelectRequestCommand + && targetIndex.equals(((SelectRequestCommand) other).targetIndex)); + } +} diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index 3b8bfa035e83..582acff5f900 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -2,59 +2,135 @@ import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; +import static seedu.address.logic.parser.CliSyntax.PREFIX_CONDITION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ORGANIZATION; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; +import static seedu.address.logic.parser.CliSyntax.PREFIX_SKILLS; import java.util.Set; import java.util.stream.Stream; import seedu.address.logic.commands.AddCommand; +import seedu.address.logic.commands.AddHealthWorkerCommand; +import seedu.address.logic.commands.request.AddRequestCommand; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; -import seedu.address.model.person.Email; import seedu.address.model.person.Name; -import seedu.address.model.person.Person; +import seedu.address.model.person.Nric; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.Organization; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestDate; +import seedu.address.model.tag.Condition; +import seedu.address.model.tag.Skills; /** - * Parses input arguments and creates a new AddCommand object + * Parses input arguments and creates a new AddPersonCommand object */ public class AddCommandParser implements Parser { + public static final String INVALID_COMMAND_USAGE = AddCommand.MESSAGE_USAGE + "\n" + + AddHealthWorkerCommand.MESSAGE_USAGE + "\n\n" + AddRequestCommand.MESSAGE_USAGE; + private static final String PREAMBLE_WHITESPACE = " "; + + /** + * Returns true if none of the prefixes contains empty {@code Optional} values in the given + * {@code ArgumentMultimap}. + */ + private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { + return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); + } + /** - * Parses the given {@code String} of arguments in the context of the AddCommand - * and returns an AddCommand object for execution. + * Parses the given {@code String} of arguments in the context of the AddPersonCommand + * and returns an AddPersonCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ + @Override public AddCommand parse(String args) throws ParseException { - ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); + CommandMode commandMode = ArgumentTokenizer.checkMode(args); - if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) - || !argMultimap.getPreamble().isEmpty()) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); + if (commandMode == CommandMode.HEALTH_WORKER) { + try { + return parseAddHealthWorker(PREAMBLE_WHITESPACE + ArgumentTokenizer.trimMode(args)); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + AddHealthWorkerCommand.MESSAGE_USAGE)); + } + } else if (commandMode == CommandMode.REQUEST) { + try { + return parseAddRequest(PREAMBLE_WHITESPACE + ArgumentTokenizer.trimMode(args)); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + AddRequestCommand.MESSAGE_USAGE)); + } } - Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); - Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); - Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); - Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); - Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, INVALID_COMMAND_USAGE)); + } + + /** + * Parses the given {@code String} of arguments in the context of the AddRequestCommand + * and returns an AddReqeustCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + private AddRequestCommand parseAddRequest(String args) throws ParseException { - Person person = new Person(name, phone, email, address, tagList); + ArgumentMultimap argumentMultimap = ArgumentTokenizer.tokenize(args, + PREFIX_NAME, PREFIX_NRIC, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_DATE, PREFIX_CONDITION); - return new AddCommand(person); + if (!arePrefixesPresent(argumentMultimap, PREFIX_NAME, PREFIX_NRIC, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_DATE, + PREFIX_CONDITION)) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + AddRequestCommand.MESSAGE_USAGE)); + } + + Name name = ParserUtil.parseName(argumentMultimap.getValue(PREFIX_NAME).get()); + Nric nric = ParserUtil.parseNric(argumentMultimap.getValue(PREFIX_NRIC).get()); + Phone phone = ParserUtil.parsePhone(argumentMultimap.getValue(PREFIX_PHONE).get()); + Address address = ParserUtil.parseAddress(argumentMultimap.getValue(PREFIX_ADDRESS).get()); + RequestDate requestDate = + ParserUtil.parseRequestDate(argumentMultimap.getValue(PREFIX_DATE).get()); + Set conditions = + ParserUtil.parseConditions(argumentMultimap.getAllValues(PREFIX_CONDITION)); + + return new AddRequestCommand(new Request(name, nric, phone, address, requestDate, + conditions)); } /** - * Returns true if none of the prefixes contains empty {@code Optional} values in the given - * {@code ArgumentMultimap}. + * @author Lookaz + * Auxiliary method for parsing the adding of HealthWorker objects + * @param args argument list for add command + * @return new AddHealthWorkerCommand for the adding of health worker + * with the fields specified in args + * @throws ParseException if there are invalid/unfilled fields. */ - private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { - return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); + private AddHealthWorkerCommand parseAddHealthWorker(String args) throws ParseException { + + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, + PREFIX_NAME, PREFIX_PHONE, PREFIX_ORGANIZATION, PREFIX_NRIC, PREFIX_SKILLS); + + if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_NRIC, PREFIX_ORGANIZATION, + PREFIX_PHONE, PREFIX_SKILLS)) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + AddHealthWorkerCommand.MESSAGE_USAGE)); + } + + Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); + Nric nric = ParserUtil.parseNric(argMultimap.getValue(PREFIX_NRIC).get()); + Organization organization = ParserUtil.parseOrganization(argMultimap + .getValue(PREFIX_ORGANIZATION).get()); + Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); + Skills skills = ParserUtil.parseSpecialisations(argMultimap.getAllValues(PREFIX_SKILLS)); + + HealthWorker healthWorker = new HealthWorker(name, nric, phone, organization, skills); + + return new AddHealthWorkerCommand(healthWorker); } } diff --git a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java b/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java index 954c8e18f8ea..9c73c067b36d 100644 --- a/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java +++ b/src/main/java/seedu/address/logic/parser/ArgumentMultimap.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; /** * Stores mapping of prefixes to their respective arguments. @@ -51,6 +52,13 @@ public List getAllValues(Prefix prefix) { return new ArrayList<>(argMultimap.get(prefix)); } + /** + * Returns all keys prefixes. + */ + public Set getAllPrefixes() { + return argMultimap.keySet(); + } + /** * Returns the preamble (text before the first valid prefix). Trims any leading/trailing spaces. */ diff --git a/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java b/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java index 5c9aebfa4888..bfa656dbcefa 100644 --- a/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java +++ b/src/main/java/seedu/address/logic/parser/ArgumentTokenizer.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -28,6 +29,29 @@ public static ArgumentMultimap tokenize(String argsString, Prefix... prefixes) { return extractArguments(argsString, positions); } + /** + * @author Lookaz + * Checks a given argument string and returns the corresponding + * CommandMode enum + * @param args argument string to check + * @return CommandMode enum type if available, else CommandMode.INVALID + */ + public static CommandMode checkMode(String args) throws NullPointerException { + String commandMode = args.trim().split("\\s")[0]; + return CommandMode.checkMode(commandMode); + } + + /** + * @author Lookaz + * Trims the argument string from it's command mode in the first two indices. + * Precondition: First two indices of argument string must contain a command mode number followed by a space. + * @param args argument string to trim + * @return trimmed argument string. + */ + public static String trimMode(String args) throws ArrayIndexOutOfBoundsException { + return args.trim().split("\\s", 2)[1]; + } + /** * Finds all zero-based prefix positions in the given arguments string. * @@ -87,7 +111,7 @@ private static int findPrefixPosition(String argsString, String prefix, int from private static ArgumentMultimap extractArguments(String argsString, List prefixPositions) { // Sort by start position - prefixPositions.sort((prefix1, prefix2) -> prefix1.getStartPosition() - prefix2.getStartPosition()); + prefixPositions.sort(Comparator.comparingInt(PrefixPosition::getStartPosition)); // Insert a PrefixPosition to represent the preamble PrefixPosition preambleMarker = new PrefixPosition(new Prefix(""), 0); diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index 75b1a9bf1190..1c9a31b0eca5 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -7,9 +7,27 @@ public class CliSyntax { /* Prefix definitions */ public static final Prefix PREFIX_NAME = new Prefix("n/"); + public static final Prefix PREFIX_NRIC = new Prefix("i/"); public static final Prefix PREFIX_PHONE = new Prefix("p/"); public static final Prefix PREFIX_EMAIL = new Prefix("e/"); public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); public static final Prefix PREFIX_TAG = new Prefix("t/"); + public static final Prefix PREFIX_DATE = new Prefix("dt/"); + public static final Prefix PREFIX_CONDITION = new Prefix("c/"); + public static final Prefix PREFIX_HEALTHWORKER = new Prefix("hw/"); + public static final Prefix PREFIX_REQUEST = new Prefix("r/"); + public static final Prefix PREFIX_STATUS = new Prefix("st/"); + // Additional prefixes for HealthWorker + public static final Prefix PREFIX_ORGANIZATION = new Prefix("o/"); + public static final Prefix PREFIX_SKILLS = new Prefix("s/"); + + /* Prefixes for Add/Edit/Delete Command modes */ + public static final Prefix PREFIX_ADD_HEALTHWORKER = new Prefix("1"); + public static final Prefix PREFIX_ADD_PATIENT = new Prefix("3"); + public static final Prefix PREFIX_ADD_REQUEST = new Prefix("2"); + + /* Prefixes for setting reminders */ + public static final Prefix PREFIX_TIME = new Prefix("t/"); + public static final Prefix PREFIX_MESSAGE = new Prefix("m/"); } diff --git a/src/main/java/seedu/address/logic/parser/CommandMode.java b/src/main/java/seedu/address/logic/parser/CommandMode.java new file mode 100644 index 000000000000..7c9769bde5cc --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/CommandMode.java @@ -0,0 +1,38 @@ +package seedu.address.logic.parser; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Represents the mode for AddPersonCommand, EditPersonCommand and DeletePersonCommand. + * @author Lookaz + */ +public enum CommandMode { + + HEALTH_WORKER, + PATIENT, + REQUEST, + OTHERS, + INVALID; + + public static final String MODE_HEALTHWORKER = "1"; + public static final String MODE_REQUEST = "2"; + + private static final Set healthWorkerModes = new HashSet<>(Arrays.asList("healthworker", "h", "1")); + private static final Set requestModes = new HashSet<>(Arrays.asList("request", "r", "2")); + + /** + * Method that checks for the corresponding CommandMode given a string input. + * Returns INVALID if input string does not match any of the given modes. + */ + public static CommandMode checkMode(String input) { + if (healthWorkerModes.contains(input)) { + return CommandMode.HEALTH_WORKER; + } else if (requestModes.contains(input)) { + return CommandMode.REQUEST; + } + + return CommandMode.INVALID; + } +} diff --git a/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java b/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java index 4d1f4bb0e4ec..88ee1a48d0d9 100644 --- a/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/DeleteCommandParser.java @@ -4,26 +4,48 @@ import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.DeleteCommand; +import seedu.address.logic.commands.DeleteHealthWorkerCommand; +import seedu.address.logic.commands.EditCommand; +import seedu.address.logic.commands.request.DeleteRequestCommand; import seedu.address.logic.parser.exceptions.ParseException; /** - * Parses input arguments and creates a new DeleteCommand object + * Parses input arguments and creates a new DeletePersonCommand object */ public class DeleteCommandParser implements Parser { + public static final String INVALID_COMMAND_USAGE = EditCommand.MESSAGE_USAGE + "\n" + + DeleteHealthWorkerCommand.MESSAGE_USAGE + DeleteRequestCommand.MESSAGE_USAGE; /** - * Parses the given {@code String} of arguments in the context of the DeleteCommand - * and returns an DeleteCommand object for execution. + * Parses the given {@code String} of arguments in the context of the DeletePersonCommand + * and returns an DeletePersonCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ public DeleteCommand parse(String args) throws ParseException { - try { - Index index = ParserUtil.parseIndex(args); - return new DeleteCommand(index); - } catch (ParseException pe) { - throw new ParseException( - String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE), pe); + Index index; + + CommandMode commandMode = ArgumentTokenizer.checkMode(args); + + if (commandMode == CommandMode.HEALTH_WORKER) { + try { + index = ParserUtil.parseIndex(ArgumentTokenizer.trimMode(args)); + return new DeleteHealthWorkerCommand(index); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + DeleteHealthWorkerCommand.MESSAGE_USAGE)); + } + + } else if (commandMode == CommandMode.REQUEST) { + try { + index = ParserUtil.parseIndex(ArgumentTokenizer.trimMode(args)); + return new DeleteRequestCommand(index); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + DeleteRequestCommand.MESSAGE_USAGE)); + } } - } + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + INVALID_COMMAND_USAGE)); + } } diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/seedu/address/logic/parser/EditCommandParser.java index 845644b7dea1..18af9739d541 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/EditCommandParser.java @@ -3,80 +3,146 @@ import static java.util.Objects.requireNonNull; import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; -import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; +import static seedu.address.logic.parser.CliSyntax.PREFIX_CONDITION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ORGANIZATION; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; -import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; - -import java.util.Collection; -import java.util.Collections; -import java.util.Optional; -import java.util.Set; +import static seedu.address.logic.parser.CliSyntax.PREFIX_SKILLS; +import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS; import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.EditCommand; -import seedu.address.logic.commands.EditCommand.EditPersonDescriptor; +import seedu.address.logic.commands.EditHealthWorkerCommand; +import seedu.address.logic.commands.EditHealthWorkerCommand.EditHealthWorkerDescriptor; +import seedu.address.logic.commands.request.EditRequestCommand; +import seedu.address.logic.commands.request.EditRequestCommand.EditRequestDescriptor; import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.tag.Tag; /** * Parses input arguments and creates a new EditCommand object */ public class EditCommandParser implements Parser { + public static final String INVALID_COMMAND_USAGE = EditCommand.MESSAGE_USAGE + "\n" + + EditHealthWorkerCommand.MESSAGE_USAGE + EditRequestCommand.MESSAGE_USAGE; + /** - * Parses the given {@code String} of arguments in the context of the EditCommand - * and returns an EditCommand object for execution. + * Parses the given {@code String} of arguments in the context of the EditPersonCommand + * and returns an EditPersonCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ public EditCommand parse(String args) throws ParseException { requireNonNull(args); - ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); + CommandMode commandMode = ArgumentTokenizer.checkMode(args); + if (commandMode == CommandMode.HEALTH_WORKER) { + try { + return parseEditHealthWorker(ArgumentTokenizer.trimMode(args)); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + EditHealthWorkerCommand.MESSAGE_NOT_EDITED), e); + } + } else if (commandMode == CommandMode.REQUEST) { + try { + return parseEditRequest(ArgumentTokenizer.trimMode(args)); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + EditRequestCommand.MESSAGE_NOT_EDITED), e); + } + } + + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, INVALID_COMMAND_USAGE)); + } + + /** + * @author Lookaz + * Parses the arguments into respective fields for edit in EditHealthWorkerCommand. + * @throws ParseException if the user input does not conform the expected format + */ + private EditHealthWorkerCommand parseEditHealthWorker(String args) throws ParseException { + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_NRIC, + PREFIX_ORGANIZATION, PREFIX_SKILLS); Index index; try { index = ParserUtil.parseIndex(argMultimap.getPreamble()); } catch (ParseException pe) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE), pe); + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + EditHealthWorkerCommand.MESSAGE_USAGE), pe); } - - EditPersonDescriptor editPersonDescriptor = new EditPersonDescriptor(); + EditHealthWorkerDescriptor descriptor = new EditHealthWorkerDescriptor(); if (argMultimap.getValue(PREFIX_NAME).isPresent()) { - editPersonDescriptor.setName(ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get())); + descriptor.setName(ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get())); + } + if (argMultimap.getValue(PREFIX_NRIC).isPresent()) { + descriptor.setNric(ParserUtil.parseNric(argMultimap.getValue(PREFIX_NRIC).get())); } if (argMultimap.getValue(PREFIX_PHONE).isPresent()) { - editPersonDescriptor.setPhone(ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get())); + descriptor.setPhone(ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get())); } - if (argMultimap.getValue(PREFIX_EMAIL).isPresent()) { - editPersonDescriptor.setEmail(ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get())); + if (argMultimap.getValue(PREFIX_ORGANIZATION).isPresent()) { + descriptor.setOrganization(ParserUtil.parseOrganization(argMultimap.getValue(PREFIX_ORGANIZATION).get())); } - if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) { - editPersonDescriptor.setAddress(ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get())); + if (argMultimap.getValue(PREFIX_SKILLS).isPresent()) { + descriptor.setSkills(ParserUtil.parseSpecialisations(argMultimap.getAllValues(PREFIX_SKILLS))); } - parseTagsForEdit(argMultimap.getAllValues(PREFIX_TAG)).ifPresent(editPersonDescriptor::setTags); - if (!editPersonDescriptor.isAnyFieldEdited()) { - throw new ParseException(EditCommand.MESSAGE_NOT_EDITED); + if (!descriptor.isAnyFieldEdited()) { + throw new ParseException(EditHealthWorkerCommand.MESSAGE_NOT_EDITED); } - return new EditCommand(index, editPersonDescriptor); + return new EditHealthWorkerCommand(index, descriptor); } /** - * Parses {@code Collection tags} into a {@code Set} if {@code tags} is non-empty. - * If {@code tags} contain only one element which is an empty string, it will be parsed into a - * {@code Set} containing zero tags. + * @author Lookaz + * Method for parsing the arguments into respective fields for edit in EditRequestCommand. + * @throws ParseException if user does not confirm to command format */ - private Optional> parseTagsForEdit(Collection tags) throws ParseException { - assert tags != null; + private EditRequestCommand parseEditRequest(String args) throws ParseException { + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, + PREFIX_NAME, PREFIX_NRIC, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_DATE, + PREFIX_CONDITION, PREFIX_STATUS); + + Index index; + + try { + index = ParserUtil.parseIndex(argMultimap.getPreamble()); + } catch (ParseException pe) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + EditRequestCommand.MESSAGE_USAGE), pe); + } + EditRequestDescriptor descriptor = new EditRequestDescriptor(); + if (argMultimap.getValue(PREFIX_NAME).isPresent()) { + descriptor.setName(ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get())); + } + if (argMultimap.getValue(PREFIX_NRIC).isPresent()) { + descriptor.setNric(ParserUtil.parseNric(argMultimap.getValue(PREFIX_NRIC).get())); + } + if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) { + descriptor.setAddress(ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get())); + } + if (argMultimap.getValue(PREFIX_PHONE).isPresent()) { + descriptor.setPhone(ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get())); + } + if (argMultimap.getValue(PREFIX_DATE).isPresent()) { + descriptor.setDate(ParserUtil.parseRequestDate(argMultimap.getValue(PREFIX_DATE).get())); + } + if (argMultimap.getValue(PREFIX_CONDITION).isPresent()) { + descriptor.setConditions(ParserUtil.parseConditions(argMultimap.getAllValues(PREFIX_CONDITION))); + } + if (argMultimap.getValue(PREFIX_STATUS).isPresent()) { + descriptor.setRequestStatus(ParserUtil.parseRequestStatus(argMultimap.getValue(PREFIX_STATUS) + .get().toUpperCase())); + } - if (tags.isEmpty()) { - return Optional.empty(); + if (!descriptor.isAnyFieldEdited()) { + throw new ParseException(EditRequestCommand.MESSAGE_NOT_EDITED); } - Collection tagSet = tags.size() == 1 && tags.contains("") ? Collections.emptySet() : tags; - return Optional.of(ParserUtil.parseTags(tagSet)); + + return new EditRequestCommand(index, descriptor); } } diff --git a/src/main/java/seedu/address/logic/parser/FilterCommandParser.java b/src/main/java/seedu/address/logic/parser/FilterCommandParser.java new file mode 100644 index 000000000000..56b224e6240a --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/FilterCommandParser.java @@ -0,0 +1,142 @@ +package seedu.address.logic.parser; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; +import static seedu.address.logic.parser.CliSyntax.PREFIX_CONDITION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; +import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; +import static seedu.address.logic.parser.CliSyntax.PREFIX_ORGANIZATION; +import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_SKILLS; +import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import seedu.address.commons.core.Messages; +import seedu.address.logic.commands.FilterCommand; +import seedu.address.logic.commands.FilterHealthWorkerCommand; +import seedu.address.logic.commands.request.FilterRequestCommand; +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.request.Request; +import seedu.address.model.tag.Specialisation; + +/** + * @author Lookaz + * Parses input arguments and creates a new FilterHealthWorkerCommand object + */ +public class FilterCommandParser implements Parser { + + public static final String MESSAGE_USAGE = FilterCommand.INVALID_MESSAGE_FORMAT + "\n" + + FilterHealthWorkerCommand.MESSAGE_USAGE; + + private static final String PREAMBLE_WHITESPACE = " "; + + /** + * Parses the given {@code String} of arguments in the context of the FilterHealthWorkerCommand + * and returns an FilterHealthWorkerCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public FilterCommand parse(String args) throws ParseException { + String trimmedArgs = args.trim(); + if (trimmedArgs.isEmpty()) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, MESSAGE_USAGE)); + } + + CommandMode commandMode = ArgumentTokenizer.checkMode(trimmedArgs); + if (commandMode == CommandMode.HEALTH_WORKER) { + try { + return new FilterHealthWorkerCommand(parseHealthWorkerPredicates(PREAMBLE_WHITESPACE + + ArgumentTokenizer.trimMode(args))); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + FilterHealthWorkerCommand.MESSAGE_USAGE)); + } + } else if (commandMode == CommandMode.REQUEST) { + try { + return new FilterRequestCommand(parseRequestPredicates(PREAMBLE_WHITESPACE + + ArgumentTokenizer.trimMode(args))); + } catch (ArrayIndexOutOfBoundsException e) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + FilterRequestCommand.MESSAGE_USAGE)); + } + } + + throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, + MESSAGE_USAGE)); + } + + /** + * Method that parses a string of parameters into a list of predicates for filtering health workers in a list. + */ + public static List parseHealthWorkerPredicates(String args) throws ParseException { + ArgumentMultimap argumentMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_NRIC, + PREFIX_SKILLS, PREFIX_ORGANIZATION); + + if (!anyPrefixPresent(argumentMultimap, PREFIX_NAME, PREFIX_NRIC, + PREFIX_SKILLS, PREFIX_ORGANIZATION)) { + throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, + FilterHealthWorkerCommand.MESSAGE_USAGE)); + } + + List predicateList = new ArrayList<>(); + + if (argumentMultimap.getValue(PREFIX_NAME).isPresent()) { + predicateList.add(x -> ((HealthWorker) x).getName().contains(argumentMultimap.getValue(PREFIX_NAME).get())); + } + if (argumentMultimap.getValue(PREFIX_ORGANIZATION).isPresent()) { + predicateList.add(x -> ((HealthWorker) x).getOrganization().contains(argumentMultimap + .getValue(PREFIX_ORGANIZATION).get())); + } + if (argumentMultimap.getValue(PREFIX_NRIC).isPresent()) { + predicateList.add(x -> ((HealthWorker) x).getNric().contains(argumentMultimap + .getValue(PREFIX_NRIC).get())); + } + if (argumentMultimap.getValue(PREFIX_SKILLS).isPresent()) { + Set otherSkills = new HashSet<>(); + for (String s : argumentMultimap.getAllValues(PREFIX_SKILLS)) { + Optional specialisation = Specialisation.getSpecialisation(s); + if (specialisation.isPresent()) { + otherSkills.add(specialisation.get()); + } else { + // Invalid specialisation entered, should not return any results + predicateList.add(x -> false); + } + } + predicateList.add(x -> ((HealthWorker) x).getSkills().containsAll(otherSkills)); + } + + return predicateList; + } + + /** + * Method that parses a string of prefix arguments into a predicates for filtering requests. + */ + public static Predicate parseRequestPredicates(String args) throws ParseException { + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_ADDRESS, + PREFIX_DATE, PREFIX_CONDITION, PREFIX_STATUS, PREFIX_NRIC); + + if (!anyPrefixPresent(argMultimap, PREFIX_NAME, PREFIX_NRIC, PREFIX_PHONE, PREFIX_ADDRESS, PREFIX_DATE, + PREFIX_CONDITION, PREFIX_STATUS) || !argMultimap.getPreamble().isEmpty()) { + throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, + FilterRequestCommand.MESSAGE_USAGE)); + } + + return new RequestPredicateUtil().parsePredicate(argMultimap); + } + + /** + * Method to check if there are any existing prefixes in the ArgumentMultiMap. + */ + public static boolean anyPrefixPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { + return Stream.of(prefixes).anyMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); + } + +} diff --git a/src/main/java/seedu/address/logic/parser/FindCommandParser.java b/src/main/java/seedu/address/logic/parser/FindCommandParser.java deleted file mode 100644 index b186a967cb94..000000000000 --- a/src/main/java/seedu/address/logic/parser/FindCommandParser.java +++ /dev/null @@ -1,33 +0,0 @@ -package seedu.address.logic.parser; - -import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; - -import java.util.Arrays; - -import seedu.address.logic.commands.FindCommand; -import seedu.address.logic.parser.exceptions.ParseException; -import seedu.address.model.person.NameContainsKeywordsPredicate; - -/** - * Parses input arguments and creates a new FindCommand object - */ -public class FindCommandParser implements Parser { - - /** - * Parses the given {@code String} of arguments in the context of the FindCommand - * and returns an FindCommand object for execution. - * @throws ParseException if the user input does not conform the expected format - */ - public FindCommand parse(String args) throws ParseException { - String trimmedArgs = args.trim(); - if (trimmedArgs.isEmpty()) { - throw new ParseException( - String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE)); - } - - String[] nameKeywords = trimmedArgs.split("\\s+"); - - return new FindCommand(new NameContainsKeywordsPredicate(Arrays.asList(nameKeywords))); - } - -} diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/HealthHubParser.java similarity index 60% rename from src/main/java/seedu/address/logic/parser/AddressBookParser.java rename to src/main/java/seedu/address/logic/parser/HealthHubParser.java index b7d57f5db86a..8ada4a6e9be8 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/HealthHubParser.java @@ -7,24 +7,37 @@ import java.util.regex.Pattern; import seedu.address.logic.commands.AddCommand; -import seedu.address.logic.commands.ClearCommand; import seedu.address.logic.commands.Command; import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.EditCommand; import seedu.address.logic.commands.ExitCommand; -import seedu.address.logic.commands.FindCommand; +import seedu.address.logic.commands.FilterCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.HistoryCommand; import seedu.address.logic.commands.ListCommand; +import seedu.address.logic.commands.ListCommandParser; import seedu.address.logic.commands.RedoCommand; import seedu.address.logic.commands.SelectCommand; +import seedu.address.logic.commands.SetReminderCommand; +import seedu.address.logic.commands.StatisticsCommand; import seedu.address.logic.commands.UndoCommand; +//import seedu.address.logic.commands.SelectCommand; +import seedu.address.logic.commands.request.AssignRequestCommand; +import seedu.address.logic.commands.request.ClearRequestCommand; +import seedu.address.logic.commands.request.CompleteRequestCommand; +//import seedu.address.logic.commands.request.DeleteRequestCommand; +//import seedu.address.logic.commands.request.FindRequestCommand; +//import seedu.address.logic.commands.request.ListRequestCommand; +import seedu.address.logic.commands.request.SelectRequestCommand; import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.logic.parser.request.AssignRequestCommandParser; +import seedu.address.logic.parser.request.CompleteRequestParser; + /** * Parses user input. */ -public class AddressBookParser { +public class HealthHubParser { /** * Used for initial separation of command word and args. @@ -48,6 +61,21 @@ public Command parseCommand(String userInput) throws ParseException { final String arguments = matcher.group("arguments"); switch (commandWord) { + case CompleteRequestCommand.COMMAND_WORD: + return new CompleteRequestParser().parse(arguments); + + case ClearRequestCommand.COMMAND_WORD: + return new ClearRequestCommand(); + + case AssignRequestCommand.COMMAND_WORD: + return new AssignRequestCommandParser().parse(arguments); + + case SelectRequestCommand.COMMAND_WORD: + return new SelectRequestCommandParser().parse(arguments); + + case DeleteCommand.COMMAND_WORD: + return new DeleteCommandParser().parse(arguments); + case AddCommand.COMMAND_WORD: return new AddCommandParser().parse(arguments); @@ -57,21 +85,21 @@ public Command parseCommand(String userInput) throws ParseException { case SelectCommand.COMMAND_WORD: return new SelectCommandParser().parse(arguments); - case DeleteCommand.COMMAND_WORD: - return new DeleteCommandParser().parse(arguments); - - case ClearCommand.COMMAND_WORD: - return new ClearCommand(); + //case ClearCommand.COMMAND_WORD: + //return new ClearCommand(); - case FindCommand.COMMAND_WORD: - return new FindCommandParser().parse(arguments); + case FilterCommand.COMMAND_WORD: + return new FilterCommandParser().parse(arguments); case ListCommand.COMMAND_WORD: - return new ListCommand(); + return new ListCommandParser().parse(arguments); case HistoryCommand.COMMAND_WORD: return new HistoryCommand(); + case SetReminderCommand.COMMAND_WORD: + return new SetReminderCommandParser().parse(arguments); + case ExitCommand.COMMAND_WORD: return new ExitCommand(); @@ -84,6 +112,9 @@ public Command parseCommand(String userInput) throws ParseException { case RedoCommand.COMMAND_WORD: return new RedoCommand(); + case StatisticsCommand.COMMAND_WORD: + return new StatisticsCommand(); + default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index b117acb9c55b..f0362124f244 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -5,6 +5,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; +import java.util.stream.Stream; import seedu.address.commons.core.index.Index; import seedu.address.commons.util.StringUtil; @@ -12,8 +13,16 @@ import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; +import seedu.address.model.person.healthworker.Organization; +import seedu.address.model.request.RequestDate; +import seedu.address.model.request.RequestStatus; +import seedu.address.model.tag.Condition; +import seedu.address.model.tag.Skills; +import seedu.address.model.tag.Specialisation; + + /** * Contains utility methods used for parsing strings in the various *Parser classes. @@ -35,6 +44,19 @@ public static Index parseIndex(String oneBasedIndex) throws ParseException { return Index.fromOneBased(Integer.parseInt(trimmedIndex)); } + /** + * Parses {@code Collection tags} into a {@code Set}. + */ + public static Set parseIndexes(Collection index) throws ParseException { + requireNonNull(index); + final Set indexSet = new HashSet<>(); + for (String indexNo : index) { + indexSet.add(parseIndex(indexNo)); + } + return indexSet; + + } + /** * Parses a {@code String name} into a {@code Name}. * Leading and trailing whitespaces will be trimmed. @@ -50,6 +72,16 @@ public static Name parseName(String name) throws ParseException { return new Name(trimmedName); } + /** + * Parses a {@code String id} and returns it's respective index in the addressbook patient list. + * @return + */ + public static int parsePatientIndex(String id) { + requireNonNull(id); + String trimmedId = id.trim(); + return Integer.parseInt(trimmedId); + } + /** * Parses a {@code String phone} into a {@code Phone}. * Leading and trailing whitespaces will be trimmed. @@ -95,30 +127,140 @@ public static Email parseEmail(String email) throws ParseException { return new Email(trimmedEmail); } + // ===== Methods for parsing Patient Conditions ===== + // @author Rohan + /** + * Parses a {@code String specialisation} into a {@code Specialisation}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code specialisation} is invalid. + */ + public static Condition parseCondition(String condition) + throws ParseException { + requireNonNull(condition); + String trimmedCondition = condition.trim(); + if (!Condition.isValidConditionName(trimmedCondition)) { + throw new ParseException(Condition.MESSAGE_CONSTRAINTS); + } + + return new Condition(trimmedCondition); + } + + /** + * Parses a {@code String status} into a {@code RequestStatus}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code status} is invalid. + */ + public static RequestStatus parseRequestStatus(String status) throws ParseException { + requireNonNull(status); + String trimmedStatus = status.trim(); + if (!RequestStatus.isValidStatus(trimmedStatus)) { + throw new ParseException(RequestStatus.MESSAGE_STATUS_CONSTRAINTS); + } + + return new RequestStatus(trimmedStatus); + } + + /** + * Parses {@code Collection conditionsToAdd} into a {@code Set}. + */ + public static Set parseConditions(Collection conditionsToAdd) + throws ParseException { + requireNonNull(conditionsToAdd); + final Set conditionSet = new HashSet<>(); + for (String conditionToAdd : conditionsToAdd) { + conditionSet.add(parseCondition(conditionToAdd)); + } + return conditionSet; + } + + // ===== Methods for parsing Organisation, Nric and Specialisations ===== + // @author Lookaz + /** + * Parses a {@code String organization} into a {@code Organization}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code organization} is invalid. + */ + public static Organization parseOrganization(String organization) throws ParseException { + requireNonNull(organization); + String trimmedOrganization = organization.trim(); + if (!Organization.isValidOrgName(trimmedOrganization)) { + throw new ParseException(Organization.MESSAGE_CONSTRAINTS); + } + + return new Organization(trimmedOrganization); + } + /** - * Parses a {@code String tag} into a {@code Tag}. + * Parses a {@code String nric} into a {@code Nric}. * Leading and trailing whitespaces will be trimmed. * - * @throws ParseException if the given {@code tag} is invalid. + * @throws ParseException if the given {@code nric} is invalid. */ - public static Tag parseTag(String tag) throws ParseException { - requireNonNull(tag); - String trimmedTag = tag.trim(); - if (!Tag.isValidTagName(trimmedTag)) { - throw new ParseException(Tag.MESSAGE_CONSTRAINTS); + public static Nric parseNric(String nric) throws ParseException { + requireNonNull(nric); + String trimmedNric = nric.trim(); + if (!Nric.isValidNric(trimmedNric)) { + throw new ParseException(Nric.MESSAGE_CONSTRAINTS); } - return new Tag(trimmedTag); + + return new Nric(trimmedNric); } /** - * Parses {@code Collection tags} into a {@code Set}. + * Parses a {@code String specialisation} into a {@code Specialisation}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code specialisation} is invalid. */ - public static Set parseTags(Collection tags) throws ParseException { - requireNonNull(tags); - final Set tagSet = new HashSet<>(); - for (String tagName : tags) { - tagSet.add(parseTag(tagName)); + public static Specialisation parseSpecialisation(String specialisation) + throws ParseException { + requireNonNull(specialisation); + String trimmedSpecialisation = specialisation.trim(); + if (!Specialisation.isValidSpecialisation(trimmedSpecialisation)) { + throw new ParseException(Specialisation.MESSAGE_CONSTRAINTS); } - return tagSet; + + return Specialisation.parseString(trimmedSpecialisation); + } + + /** + * Parses {@code Collection specialisations} into a {@code + * Skills}. + */ + public static Skills parseSpecialisations(Collection specialisations) + throws ParseException { + requireNonNull(specialisations); + final Skills skills = new Skills(); + for (String specialisation : specialisations) { + skills.addSpecialisation(parseSpecialisation(specialisation)); + } + return skills; + } + + /** + * Parses {@code String date} into a {@code RequestDate}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code date} is invalid. + */ + public static RequestDate parseRequestDate(String date) throws ParseException { + requireNonNull(date); + String trimmedDate = date.trim(); + if (!RequestDate.isValidDate(trimmedDate)) { + throw new ParseException(RequestDate.MESSAGE_CONSTRAINTS); + } + + return new RequestDate(trimmedDate); + } + + /** + * Returns true if none of the prefixes contains empty {@code Optional} values in the given + * {@code ArgumentMultimap}. + */ + public static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { + return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); } } diff --git a/src/main/java/seedu/address/logic/parser/RequestPredicateUtil.java b/src/main/java/seedu/address/logic/parser/RequestPredicateUtil.java new file mode 100644 index 000000000000..545bc9e72787 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/RequestPredicateUtil.java @@ -0,0 +1,168 @@ +package seedu.address.logic.parser; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.function.Predicate; + +import seedu.address.logic.commands.request.FilterRequestCommand; +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.logic.parser.request.RequestDatePredicateUtil; +import seedu.address.logic.parser.request.RequestStatusPredicateUtil; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestAddressContainsKeywordPredicate; +import seedu.address.model.request.RequestConditionContainsKeywordPredicate; +import seedu.address.model.request.RequestDatePredicate; +import seedu.address.model.request.RequestNameContainsKeywordPredicate; +import seedu.address.model.request.RequestNricContainsKeywordPredicate; +import seedu.address.model.request.RequestPhoneContainsKeywordPredicate; +import seedu.address.model.request.RequestStatus; +import seedu.address.model.request.RequestStatusContainsKeywordPredicate; + +/** + * Util to parse Request's predicate + * + * @@author daviddl9 + */ +public class RequestPredicateUtil { + public static final String MESSAGE_EMPTY_KEYWORD = "%1$s cannot be empty"; + + private static final String STRING_PREFIX_NAME = "n/"; + private static final String STRING_PREFIX_PHONE = "p/"; + private static final String STRING_PREFIX_ADDRESS = "a/"; + private static final String STRING_PREFIX_DATE = "dt/"; + private static final String STRING_PREFIX_CONDITION = "c/"; + private static final String STRING_PREFIX_STATUS = "st/"; + private static final String STRING_PREFIX_NRIC = "i/"; + private static final String STRING_PREFIX_HEALTHWORKER = "hw/"; + + private Predicate chainedPredicate; + + /** + * Parses the given {@code argMultimap} to a chained predicate and returns the chained + * predicate. + */ + public Predicate parsePredicate(ArgumentMultimap argumentMultimap) throws ParseException { + Set prefixes = argumentMultimap.getAllPrefixes(); + + for (Prefix prefix : prefixes) { + if (prefix.toString().equals("")) { + continue; + } + + List keywords = argumentMultimap.getAllValues(prefix); + + ensureNonEmptyField(prefix, keywords); + chainPredicate(prefix, keywords); + } + return chainedPredicate; + } + + /** + * Parses the different {@code prefix}, forces the related predicate and chains them up + * + * @throws ParseException if an invalid {@code prefix} is supplied + */ + private void chainPredicate(Prefix prefix, List keywords) throws ParseException { + switch (prefix.toString()) { + case STRING_PREFIX_NAME: + String name = getLastValueFromList(keywords); + RequestNameContainsKeywordPredicate namePredicate = + new RequestNameContainsKeywordPredicate(name); + + setToPredicate(namePredicate); + break; + + case STRING_PREFIX_PHONE: + String phone = getLastValueFromList(keywords); + String[] phoneKeywords = trimAndSplitStringByWhiteSpaces(phone); + RequestPhoneContainsKeywordPredicate phonePredicate = + new RequestPhoneContainsKeywordPredicate(Arrays.asList(phoneKeywords)); + + setToPredicate(phonePredicate); + break; + case STRING_PREFIX_ADDRESS: + String address = getLastValueFromList(keywords); + RequestAddressContainsKeywordPredicate predicate = + new RequestAddressContainsKeywordPredicate(address); + setToPredicate(predicate); + + break; + + case STRING_PREFIX_CONDITION: + String condition = getLastValueFromList(keywords); + RequestConditionContainsKeywordPredicate conditionContainsKeywordPredicate = + new RequestConditionContainsKeywordPredicate(condition); + setToPredicate(conditionContainsKeywordPredicate); + + break; + + case STRING_PREFIX_STATUS: + String status = getLastValueFromList(keywords); + String[] statusKeywords = trimAndSplitStringByWhiteSpaces(status); + List requestStatuses = + new RequestStatusPredicateUtil().parseOrderStatusKeywords(Arrays.asList(statusKeywords)); + RequestStatusContainsKeywordPredicate statusPredicate = + new RequestStatusContainsKeywordPredicate(requestStatuses); + + setToPredicate(statusPredicate); + break; + + case STRING_PREFIX_NRIC: + String nric = getLastValueFromList(keywords); + RequestNricContainsKeywordPredicate requestNricContainsKeywordPredicate = + new RequestNricContainsKeywordPredicate(nric); + setToPredicate(requestNricContainsKeywordPredicate); + + break; + + case STRING_PREFIX_DATE: + List date = new RequestDatePredicateUtil().parseDateKeywords(keywords); + RequestDatePredicate datePredicate = new RequestDatePredicate(date); + setToPredicate(datePredicate); + + break; + + default: + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + FilterRequestCommand.MESSAGE_USAGE)); + } + } + private String getLastValueFromList(List list) { + int lastIndex = list.size() - 1; + return list.get(lastIndex); + } + + private String[] trimAndSplitStringByWhiteSpaces(String value) { + return value.trim().split("\\s+"); + } + + /** + * Set {@code chainedPredicate} to {@code predicate} if predicate is not set + * else AND the predicates + */ + private void setToPredicate(Predicate predicate) { + // predicate is not set + if (chainedPredicate == null) { + chainedPredicate = predicate; + } else { + chainedPredicate = chainedPredicate.and(predicate); + } + } + + /** + * Ensure if prefix given has a non-empty field + * + * @throws ParseException if one prefix is empty + */ + private void ensureNonEmptyField(Prefix prefix, List keywords) throws ParseException { + for (String keyword : keywords) { + if (keyword.equals("")) { + throw new ParseException(String.format(MESSAGE_EMPTY_KEYWORD, prefix.toString())); + } + } + } +} diff --git a/src/main/java/seedu/address/logic/parser/RequestStatusPredicateUtil.java b/src/main/java/seedu/address/logic/parser/RequestStatusPredicateUtil.java new file mode 100644 index 000000000000..85528993b83f --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/RequestStatusPredicateUtil.java @@ -0,0 +1,33 @@ +package seedu.address.logic.parser.request; + +import java.util.ArrayList; +import java.util.List; + +import seedu.address.logic.parser.exceptions.ParseException; +import seedu.address.model.request.RequestStatus; + +/** + * Parses of status keywords and returns a valid status list + */ +public class RequestStatusPredicateUtil { + + /** + * Parses a list of {@code stringStatus} and returns a list of RequestStatus object + * @throws ParseException if invalid status is supplied + */ + public List parseOrderStatusKeywords(List stringStatuses) throws ParseException { + List statuses = new ArrayList<>(); + + for (String stringStatus : stringStatuses) { + String upperCaseStringStatus = stringStatus.toUpperCase(); + + if (!RequestStatus.isValidStatus(upperCaseStringStatus)) { + throw new ParseException(RequestStatus.MESSAGE_STATUS_CONSTRAINTS); + } + + statuses.add(new RequestStatus(upperCaseStringStatus)); + } + + return statuses; + } +} diff --git a/src/main/java/seedu/address/logic/parser/SelectRequestCommandParser.java b/src/main/java/seedu/address/logic/parser/SelectRequestCommandParser.java new file mode 100644 index 000000000000..ed82abadd0af --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/SelectRequestCommandParser.java @@ -0,0 +1,30 @@ +package seedu.address.logic.parser; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.request.SelectRequestCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new SelectRequestCommand object + */ +public class SelectRequestCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the SelectRequestCommand + * object for execution. + * @throws ParseException if the user input does not conform to the expected format + */ + @Override + public SelectRequestCommand parse(String userInput) throws ParseException { + try { + Index index = ParserUtil.parseIndex(userInput); + return new SelectRequestCommand(index); + } catch (ParseException pe) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, SelectRequestCommand.MESSAGE_USAGE), pe); + } + } + +} diff --git a/src/main/java/seedu/address/logic/parser/SetReminderCommandParser.java b/src/main/java/seedu/address/logic/parser/SetReminderCommandParser.java new file mode 100644 index 000000000000..6022e94226cb --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/SetReminderCommandParser.java @@ -0,0 +1,42 @@ +package seedu.address.logic.parser; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_MESSAGE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_TIME; + +import seedu.address.logic.commands.SetReminderCommand; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new SetReminderCommand object + * @author Hui Chun + */ +public class SetReminderCommandParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the + * SetReminderCommand and returns an SetReminderCommand object for execution. + * @throws ParseException if the user input does not conform the expected format + */ + public SetReminderCommand parse(String args) throws ParseException { + requireNonNull(args); + ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_TIME, PREFIX_MESSAGE); + + if (argMultimap.getValue(PREFIX_TIME).isPresent() + && argMultimap.getValue(PREFIX_MESSAGE).isPresent()) { + // if there are supplied values for time and message + String time = argMultimap.getValue(PREFIX_TIME).get(); + String message = argMultimap.getValue(PREFIX_MESSAGE).get(); + if (time.length() == 8 && time.matches("\\d+:\\d+:\\d+") + && message.length() != 0) { + return new SetReminderCommand(time, message); + } else { + throw new ParseException(SetReminderCommand.INVALID_TIME_FORMAT); + } + } else { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + SetReminderCommand.MESSAGE_USAGE)); + } + } +} diff --git a/src/main/java/seedu/address/logic/parser/request/AssignRequestCommandParser.java b/src/main/java/seedu/address/logic/parser/request/AssignRequestCommandParser.java new file mode 100644 index 000000000000..0d1ec6b5a2c4 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/request/AssignRequestCommandParser.java @@ -0,0 +1,41 @@ +package seedu.address.logic.parser.request; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.CliSyntax.PREFIX_HEALTHWORKER; +import static seedu.address.logic.parser.CliSyntax.PREFIX_REQUEST; + +import java.util.Set; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.request.AssignRequestCommand; +import seedu.address.logic.parser.ArgumentMultimap; +import seedu.address.logic.parser.ArgumentTokenizer; +import seedu.address.logic.parser.Parser; +import seedu.address.logic.parser.ParserUtil; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new AssignRequestCommand object + * + * @@author daviddl9 + */ +public class AssignRequestCommandParser implements Parser { + @Override + public AssignRequestCommand parse(String userInput) throws ParseException { + ArgumentMultimap argumentMultimap = ArgumentTokenizer.tokenize(userInput, + PREFIX_HEALTHWORKER, PREFIX_REQUEST); + + if (!ParserUtil.arePrefixesPresent(argumentMultimap, PREFIX_HEALTHWORKER, PREFIX_REQUEST) + || !argumentMultimap.getPreamble().isEmpty()) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + AssignRequestCommand.MESSAGE_USAGE)); + } + + Index healthWorkerId = + ParserUtil.parseIndex(argumentMultimap.getValue(PREFIX_HEALTHWORKER).get()); + Set requestIds = + ParserUtil.parseIndexes(argumentMultimap.getAllValues(PREFIX_REQUEST)); + + return new AssignRequestCommand(healthWorkerId, requestIds); + } +} diff --git a/src/main/java/seedu/address/logic/parser/request/CompleteRequestParser.java b/src/main/java/seedu/address/logic/parser/request/CompleteRequestParser.java new file mode 100644 index 000000000000..4c18185e6b32 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/request/CompleteRequestParser.java @@ -0,0 +1,34 @@ +package seedu.address.logic.parser.request; + +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; + +import seedu.address.commons.core.index.Index; +import seedu.address.logic.commands.request.CompleteRequestCommand; +import seedu.address.logic.parser.Parser; +import seedu.address.logic.parser.ParserUtil; +import seedu.address.logic.parser.exceptions.ParseException; + +/** + * Parses input arguments and creates a new CompleteRequestCommand object + * + * @@author daviddl9 + */ +public class CompleteRequestParser implements Parser { + + /** + * Parses the given {@code String} of arguments in the context of the CompleteRequestCommand + * and returns an CompleteRequestCommand object for execution. + * + * @throws ParseException if the user input does not conform the expected format + */ + @Override + public CompleteRequestCommand parse(String userInput) throws ParseException { + try { + Index index = ParserUtil.parseIndex(userInput); + return new CompleteRequestCommand(index); + } catch (ParseException pe) { + throw new ParseException( + String.format(MESSAGE_INVALID_COMMAND_FORMAT, CompleteRequestCommand.MESSAGE_USAGE), pe); + } + } +} diff --git a/src/main/java/seedu/address/logic/parser/request/RequestDatePredicateUtil.java b/src/main/java/seedu/address/logic/parser/request/RequestDatePredicateUtil.java new file mode 100644 index 000000000000..5b41794e2ba4 --- /dev/null +++ b/src/main/java/seedu/address/logic/parser/request/RequestDatePredicateUtil.java @@ -0,0 +1,63 @@ +package seedu.address.logic.parser.request; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import seedu.address.logic.parser.exceptions.ParseException; + +import seedu.address.model.request.RequestDate; + +/** + * Parses of date keywords and returns a valid date list + * + * @@author daviddl9 + */ +public class RequestDatePredicateUtil { + private static final int VALID_DATE_LIST_SIZE = 2; + + private static final SimpleDateFormat sf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + + /** + * Sorts the dates in ascending request + * Returns a list of size 2 if more than 2 date fields are specified + */ + public List parseDateKeywords(List keywords) throws ParseException { + final int firstIndex = 0; + final int lastIndex = keywords.size() - 1; + + List dates = parseStringToDate(keywords); + + Collections.sort(dates); + + if (dates.size() > VALID_DATE_LIST_SIZE) { + List newKeywords = new ArrayList<>(); + newKeywords.add(dates.get(firstIndex)); + newKeywords.add(dates.get(lastIndex)); + return newKeywords; + } + + return dates; + } + + /** + * Parses a list of {@code stringDates} and returns a list of Date object + * @throws ParseException if invalid date format is supplied + */ + private List parseStringToDate(List stringsDates) throws ParseException { + List dates = new ArrayList<>(); + + for (String stringDate : stringsDates) { + try { + sf.setLenient(false); + dates.add(sf.parse(stringDate)); + } catch (java.text.ParseException pE) { + throw new ParseException(RequestDate.MESSAGE_CONSTRAINTS); + } + } + + return dates; + } +} diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java deleted file mode 100644 index 30557cf81ee7..000000000000 --- a/src/main/java/seedu/address/model/AddressBook.java +++ /dev/null @@ -1,144 +0,0 @@ -package seedu.address.model; - -import static java.util.Objects.requireNonNull; - -import java.util.List; - -import javafx.beans.InvalidationListener; -import javafx.collections.ObservableList; -import seedu.address.commons.util.InvalidationListenerManager; -import seedu.address.model.person.Person; -import seedu.address.model.person.UniquePersonList; - -/** - * Wraps all data at the address-book level - * Duplicates are not allowed (by .isSamePerson comparison) - */ -public class AddressBook implements ReadOnlyAddressBook { - - private final UniquePersonList persons; - private final InvalidationListenerManager invalidationListenerManager = new InvalidationListenerManager(); - - /* - * The 'unusual' code block below is an non-static initialization block, sometimes used to avoid duplication - * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html - * - * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication - * among constructors. - */ - { - persons = new UniquePersonList(); - } - - public AddressBook() {} - - /** - * Creates an AddressBook using the Persons in the {@code toBeCopied} - */ - public AddressBook(ReadOnlyAddressBook toBeCopied) { - this(); - resetData(toBeCopied); - } - - //// list overwrite operations - - /** - * Replaces the contents of the person list with {@code persons}. - * {@code persons} must not contain duplicate persons. - */ - public void setPersons(List persons) { - this.persons.setPersons(persons); - indicateModified(); - } - - /** - * Resets the existing data of this {@code AddressBook} with {@code newData}. - */ - public void resetData(ReadOnlyAddressBook newData) { - requireNonNull(newData); - - setPersons(newData.getPersonList()); - } - - //// person-level operations - - /** - * Returns true if a person with the same identity as {@code person} exists in the address book. - */ - public boolean hasPerson(Person person) { - requireNonNull(person); - return persons.contains(person); - } - - /** - * Adds a person to the address book. - * The person must not already exist in the address book. - */ - public void addPerson(Person p) { - persons.add(p); - indicateModified(); - } - - /** - * Replaces the given person {@code target} in the list with {@code editedPerson}. - * {@code target} must exist in the address book. - * The person identity of {@code editedPerson} must not be the same as another existing person in the address book. - */ - public void setPerson(Person target, Person editedPerson) { - requireNonNull(editedPerson); - - persons.setPerson(target, editedPerson); - indicateModified(); - } - - /** - * Removes {@code key} from this {@code AddressBook}. - * {@code key} must exist in the address book. - */ - public void removePerson(Person key) { - persons.remove(key); - indicateModified(); - } - - @Override - public void addListener(InvalidationListener listener) { - invalidationListenerManager.addListener(listener); - } - - @Override - public void removeListener(InvalidationListener listener) { - invalidationListenerManager.removeListener(listener); - } - - /** - * Notifies listeners that the address book has been modified. - */ - protected void indicateModified() { - invalidationListenerManager.callListeners(this); - } - - //// util methods - - @Override - public String toString() { - return persons.asUnmodifiableObservableList().size() + " persons"; - // TODO: refine later - } - - @Override - public ObservableList getPersonList() { - return persons.asUnmodifiableObservableList(); - } - - @Override - public boolean equals(Object other) { - return other == this // short circuit if same object - || (other instanceof AddressBook // instanceof handles nulls - && persons.equals(((AddressBook) other).persons)); - } - - @Override - public int hashCode() { - return persons.hashCode(); - } -} diff --git a/src/main/java/seedu/address/model/CommandType.java b/src/main/java/seedu/address/model/CommandType.java new file mode 100644 index 000000000000..31b1a97fbd1c --- /dev/null +++ b/src/main/java/seedu/address/model/CommandType.java @@ -0,0 +1,12 @@ +package seedu.address.model; + +/** + * Class that represents different types of books that were modified after a command + */ +public enum CommandType { + + HEALTHWORKER_COMMAND, + REQUEST_COMMAND, + //The following type of command affects both books + HEALTHWORKER_AND_REQUEST_COMMAND +} diff --git a/src/main/java/seedu/address/model/HealthWorkerBook.java b/src/main/java/seedu/address/model/HealthWorkerBook.java new file mode 100644 index 000000000000..4e23e417526a --- /dev/null +++ b/src/main/java/seedu/address/model/HealthWorkerBook.java @@ -0,0 +1,130 @@ +package seedu.address.model; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import javafx.beans.InvalidationListener; +import javafx.collections.ObservableList; +import seedu.address.commons.util.InvalidationListenerManager; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.UniqueHealthWorkerList; + +/** + * @author Lookaz + * Wrapper class for storing HealthWorkers and operations involving HealthWorker objects. + * Duplicates are not allowed (by .isSameHealthWorker comparison) + */ +public class HealthWorkerBook implements ReadOnlyHealthWorkerBook { + + private final UniqueHealthWorkerList uniqueHealthWorkerList; + private final InvalidationListenerManager invalidationListenerManager = new InvalidationListenerManager(); + + { + this.uniqueHealthWorkerList = new UniqueHealthWorkerList(); + } + + public HealthWorkerBook() {} + + public HealthWorkerBook(ReadOnlyHealthWorkerBook toCopy) { + this(); + resetData(toCopy); + } + + /** + * Replaces the contents of the person list with {@code persons}. + * {@code persons} must not contain duplicate persons. + */ + public void setHealthWorkers(List healthWorkers) { + this.uniqueHealthWorkerList.setHealthWorkers(healthWorkers); + indicateModified(); + } + + /** + * Resets the existing data of this {@code HealthWorkerBook} with {@code newData}. + */ + public void resetData(ReadOnlyHealthWorkerBook newData) { + requireNonNull(newData); + + setHealthWorkers(newData.getHealthWorkerList()); + } + + /** + * Returns true if a HealthWorker with the same identity as {@code worker} + * exists in the HealthWorkerBook. + */ + public boolean hasHealthWorker(HealthWorker healthWorker) { + requireNonNull(healthWorker); + return this.uniqueHealthWorkerList.contains(healthWorker); + } + + /** + * Adds a HealthWorker to the address book. + * HealthWorker object must not already exist in the HealthWorkerBook. + */ + public void addHealthWorker(HealthWorker healthWorker) { + this.uniqueHealthWorkerList.add(healthWorker); + indicateModified(); + } + + /** + * Replaces the given HealthWorker {@code target} in the list with {@code editedWorker}. + * {@code target} must exist in the HealthWorkerBook. + * The person identity of {@code editedWorker} must not be the same as another + * existing HealthWorker in the HealthWorkerBook. + */ + public void setHealthWorker(HealthWorker target, HealthWorker editedWorker) { + requireNonNull(editedWorker); + this.uniqueHealthWorkerList.setHealthWorker(target, editedWorker); + + indicateModified(); + } + + /** + * Removes {@code worker} from this {@code HealthWorkerBook}. + * {@code worker} must exist in the HealthWorkerBook. + */ + public void removeHealthWorker(HealthWorker worker) { + this.uniqueHealthWorkerList.remove(worker); + indicateModified(); + } + + /** + * Notifies listeners that HealthWorkerBook has been modified. + */ + protected void indicateModified() { + this.invalidationListenerManager.callListeners(this); + } + + @Override + public ObservableList getHealthWorkerList() { + return this.uniqueHealthWorkerList.asUnmodifiableObservableList(); + } + + @Override + public void addListener(InvalidationListener invalidationListener) { + this.invalidationListenerManager.addListener(invalidationListener); + } + + @Override + public void removeListener(InvalidationListener invalidationListener) { + this.invalidationListenerManager.removeListener(invalidationListener); + } + + @Override + public boolean equals(Object other) { + if (this == other) { + return true; + } + + return other instanceof HealthWorkerBook && this.uniqueHealthWorkerList + .equals(((HealthWorkerBook) other).uniqueHealthWorkerList); + } + + @Override + public int hashCode() { + return this.uniqueHealthWorkerList.hashCode(); + } + + +} diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index e857533821b6..d6298829bed4 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -6,14 +6,19 @@ import javafx.beans.property.ReadOnlyProperty; import javafx.collections.ObservableList; import seedu.address.commons.core.GuiSettings; -import seedu.address.model.person.Person; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.request.Request; /** * The API of the Model component. */ public interface Model { + + /** {@code Predicate} that always evaluate to true */ + Predicate PREDICATE_SHOW_ALL_HEALTHWORKERS = unused -> true; + /** {@code Predicate} that always evaluate to true */ - Predicate PREDICATE_SHOW_ALL_PERSONS = unused -> true; + Predicate PREDICATE_SHOW_ALL_REQUESTS = unused -> true; /** * Replaces user prefs data with the data in {@code userPrefs}. @@ -35,96 +40,172 @@ public interface Model { */ void setGuiSettings(GuiSettings guiSettings); + + /** Returns the HealthWorkerBook */ + ReadOnlyHealthWorkerBook getHealthWorkerBook(); + + /** Returns the user prefs' health worker book file path. */ + Path getHealthWorkerBookFilePath(); + + // ============== Added methods for AddHealthWorkerCommand =============== + // @author: Lookaz + + /** + * Returns true if a person with the same identity as {@code healthWorker} + * exists in the address book. + */ + boolean hasHealthWorker(HealthWorker healthWorker); + + /** + * Deletes the given HealthWorker. + * The HealthWorker object must exist in the address book. + */ + void deleteHealthWorker(HealthWorker target); + + /** + * Adds the given HealthWorker. + * {@code healthWorker} must not already exist in the address book. + */ + void addHealthWorker(HealthWorker healthWorker); + /** - * Returns the user prefs' address book file path. + * Replaces the given person {@code target} with {@code editedWorker}. + * {@code target} must exist in the address book. + * The identity of {@code editedWorker} must not be the same as + * another existing HealthWorker in the address book. */ - Path getAddressBookFilePath(); + void setHealthWorker(HealthWorker target, HealthWorker editedWorker); + + /** Returns an unmodifiable view of the filtered health worker list */ + ObservableList getFilteredHealthWorkerList(); /** - * Sets the user prefs' address book file path. + * Updates the filter of the filtered HealthWorker list to filter by the given {@code predicate}. + * @throws NullPointerException if {@code predicate} is null. */ - void setAddressBookFilePath(Path addressBookFilePath); + void updateFilteredHealthWorkerList(Predicate predicate); /** - * Replaces address book data with the data in {@code addressBook}. + * Selected health worker in the filtered health worker list. + * null if no health worker is selected. + */ + ReadOnlyProperty selectedHealthWorkerProperty(); + + /**\ + * Sets the selected health worker in the filtered health worker list. */ - void setAddressBook(ReadOnlyAddressBook addressBook); + void setSelectedHealthWorker(HealthWorker worker); - /** Returns the AddressBook */ - ReadOnlyAddressBook getAddressBook(); + void commitHealthWorkerBook(); /** - * Returns true if a person with the same identity as {@code person} exists in the address book. + * Updates the healthStaff field in Request class upon editing the name of a HealthWorker */ - boolean hasPerson(Person person); + void updateRequestOnNameEdit(String oldNric, String newNric); + + // ================== Request related code ========================================= + // @author David, Hui Chun /** - * Deletes the given person. - * The person must exist in the address book. + * Returns the user prefs' request book file path. */ - void deletePerson(Person target); + Path getRequestBookFilePath(); + + /** Returns the RequestBook */ + ReadOnlyRequestBook getRequestBook(); /** - * Adds the given person. - * {@code person} must not already exist in the address book. + * Returns an unmodifiable view of the request list. */ - void addPerson(Person person); + ObservableList getFilteredRequestList(); /** - * Replaces the given person {@code target} with {@code editedPerson}. - * {@code target} must exist in the address book. - * The person identity of {@code editedPerson} must not be the same as another existing person in the address book. + * Selected request in the filtered request list. + * null if no request is selected. */ - void setPerson(Person target, Person editedPerson); + ReadOnlyProperty selectedRequestProperty(); - /** Returns an unmodifiable view of the filtered person list */ - ObservableList getFilteredPersonList(); + /** + * Sets the selected request in the filtered request list. + */ + void setSelectedRequest(Request request); + + /** + * Returns true if a request with the same identity as {@code request} exists in the address + * book. + */ + boolean hasRequest(Request request); + + + /** + * Replaces the given order {@code target} with {@code editedRequest}. + * {@code target} must exist in the request book. + * The request identity of {@code editedRequest} must not be the same as another existing + * request in the request book. + */ + void updateRequest(Request target, Request editedRequest); + + /** + * Deletes the given request. + * The request must exist in the request book. + */ + void deleteRequest(Request target); /** - * Updates the filter of the filtered person list to filter by the given {@code predicate}. + * Updates the filter of the filtered order list to filter by the given {@code predicate}. + * * @throws NullPointerException if {@code predicate} is null. */ - void updateFilteredPersonList(Predicate predicate); + void updateFilteredRequestList(Predicate predicate); /** - * Returns true if the model has previous address book states to restore. + * Adds the given request. + * {@code request} must not already exist in the request book. */ - boolean canUndoAddressBook(); + void addRequest(Request request); /** - * Returns true if the model has undone address book states to restore. + * Checks if the provide name string of a HealthWorker is assigned to any existing requests */ - boolean canRedoAddressBook(); + boolean isAssigned(String name); /** - * Restores the model's address book to its previous state. + * Clears existing backing model and replaces with the provided new data. */ - void undoAddressBook(); + void resetData(ReadOnlyRequestBook newData); /** - * Restores the model's address book to its previously undone state. + * Replaces the given request {@code target} with {@code editedRequest}. + * {@code target} must exist in the request book. + * The request identity of {@code editedRequest} must not be the same as another existing + * request in the request book. + */ + void setRequest(Request target, Request editedRequest); + + void commitRequestBook(); + + /** + * Returns true if the model has previous address book states to restore. */ - void redoAddressBook(); + boolean canUndo(); /** - * Saves the current address book state for undo/redo. + * Returns true if the model has undone address book states to restore. */ - void commitAddressBook(); + boolean canRedo(); /** - * Selected person in the filtered person list. - * null if no person is selected. + * Restores the model's address book to its previous state. */ - ReadOnlyProperty selectedPersonProperty(); + void undo(); /** - * Returns the selected person in the filtered person list. - * null if no person is selected. + * Restores the model's address book to its previously undone state. */ - Person getSelectedPerson(); + void redo(); /** - * Sets the selected person in the filtered person list. + * Commits the book based on command issued. */ - void setSelectedPerson(Person person); + void commit(CommandType commandType); } diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index b56806232814..e77ce8299e39 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -16,7 +16,10 @@ import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; import seedu.address.model.person.Person; -import seedu.address.model.person.exceptions.PersonNotFoundException; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.exceptions.HealthWorkerNotFoundException; +import seedu.address.model.request.Request; +import seedu.address.model.request.exceptions.RequestNotFoundException; /** * Represents the in-memory model of the address book data. @@ -24,31 +27,45 @@ public class ModelManager implements Model { private static final Logger logger = LogsCenter.getLogger(ModelManager.class); - private final VersionedAddressBook versionedAddressBook; + private final VersionedHealthWorkerBook versionedHealthWorkerBook; + private final VersionedRequestBook versionedRequestBook; + private final ModifyCommandHistory modifyCommandHistory; private final UserPrefs userPrefs; - private final FilteredList filteredPersons; + + private final FilteredList filteredHealthWorkers; + + // TODO get versionedAddressBook tests to pass + private final FilteredList filteredRequests; private final SimpleObjectProperty selectedPerson = new SimpleObjectProperty<>(); + private final SimpleObjectProperty selectedHealthWorker = new SimpleObjectProperty<>(); + private final SimpleObjectProperty selectedRequest = new SimpleObjectProperty<>(); /** * Initializes a ModelManager with the given addressBook and userPrefs. */ - public ModelManager(ReadOnlyAddressBook addressBook, ReadOnlyUserPrefs userPrefs) { + public ModelManager(ReadOnlyHealthWorkerBook healthWorkerBook, + ReadOnlyRequestBook requestBook, + ReadOnlyUserPrefs userPrefs) { super(); - requireAllNonNull(addressBook, userPrefs); + requireAllNonNull(requestBook, healthWorkerBook, userPrefs); - logger.fine("Initializing with address book: " + addressBook + " and user prefs " + userPrefs); + logger.fine("Initializing with request book: " + requestBook + " and user prefs " + userPrefs); - versionedAddressBook = new VersionedAddressBook(addressBook); + versionedHealthWorkerBook = new VersionedHealthWorkerBook(healthWorkerBook); + versionedRequestBook = new VersionedRequestBook(requestBook); this.userPrefs = new UserPrefs(userPrefs); - filteredPersons = new FilteredList<>(versionedAddressBook.getPersonList()); - filteredPersons.addListener(this::ensureSelectedPersonIsValid); + filteredHealthWorkers = new FilteredList<>(versionedHealthWorkerBook.getHealthWorkerList()); + filteredRequests = new FilteredList<>(versionedRequestBook.getRequestList()); + filteredHealthWorkers.addListener(this::ensureSelectedHealthWorkerIsValid); + filteredRequests.addListener(this::ensureSelectedRequestIsValid); + modifyCommandHistory = new ModifyCommandHistory(); } public ModelManager() { - this(new AddressBook(), new UserPrefs()); + this(new HealthWorkerBook(), new RequestBook(), new UserPrefs()); } - //=========== UserPrefs ================================================================================== + //=========================== UserPrefs ==================================================== @Override public void setUserPrefs(ReadOnlyUserPrefs userPrefs) { @@ -72,142 +89,329 @@ public void setGuiSettings(GuiSettings guiSettings) { userPrefs.setGuiSettings(guiSettings); } + + // ======================== Implemented methods for HealthWorker through Model Interface ========================= + // @author: Lookaz + @Override - public Path getAddressBookFilePath() { - return userPrefs.getAddressBookFilePath(); + public boolean hasHealthWorker(HealthWorker healthWorker) { + requireNonNull(healthWorker); + return this.versionedHealthWorkerBook.hasHealthWorker(healthWorker); } @Override - public void setAddressBookFilePath(Path addressBookFilePath) { - requireNonNull(addressBookFilePath); - userPrefs.setAddressBookFilePath(addressBookFilePath); + public void deleteHealthWorker(HealthWorker target) { + this.versionedHealthWorkerBook.removeHealthWorker(target); } - //=========== AddressBook ================================================================================ - @Override - public void setAddressBook(ReadOnlyAddressBook addressBook) { - versionedAddressBook.resetData(addressBook); + public void addHealthWorker(HealthWorker healthWorker) { + this.versionedHealthWorkerBook.addHealthWorker(healthWorker); + updateFilteredHealthWorkerList(PREDICATE_SHOW_ALL_HEALTHWORKERS); } @Override - public ReadOnlyAddressBook getAddressBook() { - return versionedAddressBook; + public void setHealthWorker(HealthWorker target, HealthWorker editedWorker) { + requireAllNonNull(target, editedWorker); + + this.versionedHealthWorkerBook.setHealthWorker(target, editedWorker); } @Override - public boolean hasPerson(Person person) { - requireNonNull(person); - return versionedAddressBook.hasPerson(person); + public ObservableList getFilteredHealthWorkerList() { + return this.filteredHealthWorkers; } @Override - public void deletePerson(Person target) { - versionedAddressBook.removePerson(target); + public void updateFilteredHealthWorkerList(Predicate predicate) { + requireNonNull(predicate); + this.filteredHealthWorkers.setPredicate(predicate); } @Override - public void addPerson(Person person) { - versionedAddressBook.addPerson(person); - updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); + public ReadOnlyProperty selectedHealthWorkerProperty() { + return selectedHealthWorker; } @Override - public void setPerson(Person target, Person editedPerson) { - requireAllNonNull(target, editedPerson); + public void setSelectedHealthWorker(HealthWorker worker) { + if (worker != null && !filteredHealthWorkers.contains(worker)) { + throw new HealthWorkerNotFoundException(); + } + selectedHealthWorker.setValue(worker); + } - versionedAddressBook.setPerson(target, editedPerson); + @Override + public ReadOnlyHealthWorkerBook getHealthWorkerBook() { + return this.versionedHealthWorkerBook; } - //=========== Filtered Person List Accessors ============================================================= + @Override + public void commitHealthWorkerBook() { + versionedHealthWorkerBook.commit(); + } /** - * Returns an unmodifiable view of the list of {@code Person} backed by the internal list of - * {@code versionedAddressBook} + * Returns the user prefs' health worker book file path. */ @Override - public ObservableList getFilteredPersonList() { - return filteredPersons; + public Path getHealthWorkerBookFilePath() { + return userPrefs.getHealthWorkerBookFilePath(); } @Override - public void updateFilteredPersonList(Predicate predicate) { - requireNonNull(predicate); - filteredPersons.setPredicate(predicate); + public boolean isAssigned(String name) { + return this.versionedRequestBook.isAssigned(name); + } + + @Override + public void updateRequestOnNameEdit(String oldNric, String newNric) { + this.versionedRequestBook.updateHealthWorker(oldNric, newNric); } //=========== Undo/Redo ================================================================================= + // @author Jing1324 @Override - public boolean canUndoAddressBook() { - return versionedAddressBook.canUndo(); + public boolean canUndo() { + + return versionedHealthWorkerBook.canUndo() || versionedRequestBook.canUndo(); } @Override - public boolean canRedoAddressBook() { - return versionedAddressBook.canRedo(); + public boolean canRedo() { + return versionedHealthWorkerBook.canRedo() || versionedRequestBook.canRedo(); } @Override - public void undoAddressBook() { - versionedAddressBook.undo(); + public void undo() { + CommandType commandType = modifyCommandHistory.getUndoCommand(); + modifyCommandHistory.undo(); + switch(commandType) { + case HEALTHWORKER_COMMAND: + versionedHealthWorkerBook.undo(); + break; + + case REQUEST_COMMAND: + versionedRequestBook.undo(); + break; + + case HEALTHWORKER_AND_REQUEST_COMMAND: + versionedRequestBook.undo(); + versionedHealthWorkerBook.undo(); + break; + + default: + } } @Override - public void redoAddressBook() { - versionedAddressBook.redo(); + public void redo() { + CommandType commandType = modifyCommandHistory.getRedoCommand(); + modifyCommandHistory.redo(); + switch (commandType) { + case HEALTHWORKER_COMMAND: + versionedHealthWorkerBook.redo(); + break; + + case REQUEST_COMMAND: + versionedRequestBook.redo(); + break; + + case HEALTHWORKER_AND_REQUEST_COMMAND: + versionedRequestBook.redo(); + versionedHealthWorkerBook.redo(); + break; + + default: + } } @Override - public void commitAddressBook() { - versionedAddressBook.commit(); + public void commit(CommandType commandType) { + modifyCommandHistory.addLatestCommand(commandType); + switch (commandType) { + case HEALTHWORKER_COMMAND: + commitHealthWorkerBook(); + break; + + case REQUEST_COMMAND: + commitRequestBook(); + break; + + case HEALTHWORKER_AND_REQUEST_COMMAND: + commitRequestBook(); + commitHealthWorkerBook(); + break; + + default: + } } - //=========== Selected person =========================================================================== + + //=========== Implemented methods for Request through the Model interface ============================== @Override - public ReadOnlyProperty selectedPersonProperty() { - return selectedPerson; + public ObservableList getFilteredRequestList() { + return filteredRequests; + } + + /** + * Returns the user prefs' request book file path. + */ + @Override + public Path getRequestBookFilePath() { + return userPrefs.getRequestBookFilePath(); + } + + /** + * Returns the RequestBook + */ + @Override + public ReadOnlyRequestBook getRequestBook() { + return this.versionedRequestBook; + } + + /** + * Returns true if a request with the same identity as {@code request} exists in the address + * book. + * + * @param request + */ + @Override + public boolean hasRequest(Request request) { + requireNonNull(request); + return versionedRequestBook.hasRequest(request); } @Override - public Person getSelectedPerson() { - return selectedPerson.getValue(); + public void updateRequest(Request target, Request editedRequest) { + requireAllNonNull(target, editedRequest); + + versionedRequestBook.setRequest(target, editedRequest); } + /** + * Deletes the given request. + * The request must exist in the request book. + * + * @param target + */ @Override - public void setSelectedPerson(Person person) { - if (person != null && !filteredPersons.contains(person)) { - throw new PersonNotFoundException(); + public void deleteRequest(Request target) { + versionedRequestBook.removeRequest(target); + } + + @Override + public void updateFilteredRequestList(Predicate predicate) { + requireNonNull(predicate); + filteredRequests.setPredicate(predicate); + } + + /** + * Adds the given request to the request book + */ + @Override + public void addRequest(Request request) { + versionedRequestBook.addRequest(request); + updateFilteredRequestList(PREDICATE_SHOW_ALL_REQUESTS); + } + + @Override + public void resetData(ReadOnlyRequestBook newData) { + versionedRequestBook.resetData(newData); + } + + /** + * Replaces the given request {@code target} with {@code editedRequest}. + * {@code target} must exist in the request book. + * The request identity of {@code editedRequest} must not be the same as another existing + * request in the request book. + * + * @param target + * @param editedRequest + */ + @Override + public void setRequest(Request target, Request editedRequest) { + requireAllNonNull(target, editedRequest); + versionedRequestBook.setRequest(target, editedRequest); + } + + @Override + public void commitRequestBook() { + versionedRequestBook.commit(); + } + + + @Override + public ReadOnlyProperty selectedRequestProperty() { + return selectedRequest; + } + + @Override + public void setSelectedRequest(Request request) { + if (request != null && !filteredRequests.contains(request)) { + throw new RequestNotFoundException(); + } + selectedRequest.setValue(request); + } + + /** + * Ensures {@code selectedHealthWorker} is a valid request in {@code filteredHealthWorkers}. + */ + private void ensureSelectedHealthWorkerIsValid(ListChangeListener.Change change) { + while (change.next()) { + if (selectedHealthWorker.getValue() == null) { + return; + } + + boolean wasSelectedHealthWorkerReplaced = + change.wasReplaced() && change.getAddedSize() == change.getRemovedSize() + && change.getRemoved().contains(selectedHealthWorker.getValue()); + + if (wasSelectedHealthWorkerReplaced) { + // Update selectedHealthWorker to its new value + int index = change.getRemoved().indexOf(selectedHealthWorker.getValue()); + selectedHealthWorker.setValue(change.getAddedSubList().get(index)); + continue; + } + + boolean wasSelectedHealthWorkerRemoved = + change.getRemoved().stream().anyMatch(removedHealthWorker -> selectedHealthWorker.getValue() + .isSameHealthWorker(removedHealthWorker)); + if (wasSelectedHealthWorkerRemoved) { + selectedHealthWorker.setValue(change.getFrom() > 0 + ? change.getList().get(change.getFrom() - 1) : null); + } } - selectedPerson.setValue(person); } /** - * Ensures {@code selectedPerson} is a valid person in {@code filteredPersons}. + * Ensures {@code selectedRequest} is a valid request in {@code filteredRequests}. */ - private void ensureSelectedPersonIsValid(ListChangeListener.Change change) { + private void ensureSelectedRequestIsValid(ListChangeListener.Change change) { while (change.next()) { - if (selectedPerson.getValue() == null) { - // null is always a valid selected person, so we do not need to check that it is valid anymore. + if (selectedRequest.getValue() == null) { return; } - boolean wasSelectedPersonReplaced = change.wasReplaced() && change.getAddedSize() == change.getRemovedSize() - && change.getRemoved().contains(selectedPerson.getValue()); - if (wasSelectedPersonReplaced) { - // Update selectedPerson to its new value. - int index = change.getRemoved().indexOf(selectedPerson.getValue()); - selectedPerson.setValue(change.getAddedSubList().get(index)); + boolean wasSelectedRequestReplaced = + change.wasReplaced() && change.getAddedSize() == change.getRemovedSize() + && change.getRemoved().contains(selectedRequest.getValue()); + + if (wasSelectedRequestReplaced) { + // Update selectedRequest to its new value + int index = change.getRemoved().indexOf(selectedRequest.getValue()); + selectedRequest.setValue(change.getAddedSubList().get(index)); continue; } - boolean wasSelectedPersonRemoved = change.getRemoved().stream() - .anyMatch(removedPerson -> selectedPerson.getValue().isSamePerson(removedPerson)); - if (wasSelectedPersonRemoved) { - // Select the person that came before it in the list, - // or clear the selection if there is no such person. - selectedPerson.setValue(change.getFrom() > 0 ? change.getList().get(change.getFrom() - 1) : null); + boolean wasSelectedRequestRemoved = + change.getRemoved().stream().anyMatch(removedRequest -> selectedRequest.getValue() + .isSameRequest(removedRequest)); + if (wasSelectedRequestRemoved) { + selectedRequest.setValue(change.getFrom() > 0 + ? change.getList().get(change.getFrom() - 1) : null); } } } @@ -226,10 +430,13 @@ public boolean equals(Object obj) { // state check ModelManager other = (ModelManager) obj; - return versionedAddressBook.equals(other.versionedAddressBook) - && userPrefs.equals(other.userPrefs) - && filteredPersons.equals(other.filteredPersons) - && Objects.equals(selectedPerson.get(), other.selectedPerson.get()); + return versionedHealthWorkerBook.equals(other.versionedHealthWorkerBook) + && versionedRequestBook.equals(other.versionedRequestBook) + && userPrefs.equals(other.userPrefs) + && filteredRequests.equals(other.filteredRequests) + && filteredHealthWorkers.equals(filteredHealthWorkers) + && Objects.equals(selectedRequest.get(), other.selectedRequest.get()) + && Objects.equals(selectedPerson.get(), other.selectedPerson.get()); } } diff --git a/src/main/java/seedu/address/model/ModifyCommandHistory.java b/src/main/java/seedu/address/model/ModifyCommandHistory.java new file mode 100644 index 000000000000..22aa103fc3a1 --- /dev/null +++ b/src/main/java/seedu/address/model/ModifyCommandHistory.java @@ -0,0 +1,100 @@ +package seedu.address.model; + +import java.util.ArrayList; +import java.util.List; + + +/** + * Class that stores history of commands that modify the respective Books. + */ +public class ModifyCommandHistory { + + private static final int NOT_MODIFIED_YET = -1; + + private final List modifyCommandHistory; + private int currStatePointer; + + public ModifyCommandHistory() { + this.modifyCommandHistory = new ArrayList<>(); + this.currStatePointer = NOT_MODIFIED_YET; + } + + private void removeStatesAfterCurrentPointer() { + this.modifyCommandHistory.subList(this.currStatePointer + 1, + this.modifyCommandHistory.size()).clear(); + } + + /** + * Add the type of the last executed modify command into history of modify commands + * @param type The type of command that was last executed. + */ + + public void addLatestCommand(CommandType type) { + removeStatesAfterCurrentPointer(); + this.modifyCommandHistory.add(type); + this.currStatePointer++; + } + + /** + * Return the command to undo + * @return The type of command that is to be undone + */ + public CommandType getUndoCommand() { + assert(this.currStatePointer > NOT_MODIFIED_YET); + return this.modifyCommandHistory.get(currStatePointer); + } + + /** + * Return the command to undo + * @return The type of command that is to be undone + */ + + public CommandType getRedoCommand() { + assert(this.currStatePointer < modifyCommandHistory.size()); + return this.modifyCommandHistory.get(currStatePointer + 1); + } + + /** + * Restores its previous state pointer. + */ + public void undo() { + if (!canUndo()) { + throw new VersionedBook.NoUndoableStateException(); + } + this.currStatePointer--; + } + /** + * Restores its previously undone state pointer. + */ + public void redo() { + if (!canRedo()) { + throw new VersionedBook.NoRedoableStateException(); + } + this.currStatePointer++; + } + + public boolean canUndo() { + return this.currStatePointer > NOT_MODIFIED_YET; + } + + public boolean canRedo() { + return this.currStatePointer < this.modifyCommandHistory.size() - 1; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof ModifyCommandHistory)) { + return false; + } + + ModifyCommandHistory otherHistory = (ModifyCommandHistory) other; + + return super.equals(otherHistory) + && this.modifyCommandHistory.equals(otherHistory.modifyCommandHistory) + && this.currStatePointer == otherHistory.currStatePointer; + } +} diff --git a/src/main/java/seedu/address/model/ReadOnlyAddressBook.java b/src/main/java/seedu/address/model/ReadOnlyAddressBook.java deleted file mode 100644 index 6a301434b33b..000000000000 --- a/src/main/java/seedu/address/model/ReadOnlyAddressBook.java +++ /dev/null @@ -1,18 +0,0 @@ -package seedu.address.model; - -import javafx.beans.Observable; -import javafx.collections.ObservableList; -import seedu.address.model.person.Person; - -/** - * Unmodifiable view of an address book - */ -public interface ReadOnlyAddressBook extends Observable { - - /** - * Returns an unmodifiable view of the persons list. - * This list will not contain any duplicate persons. - */ - ObservableList getPersonList(); - -} diff --git a/src/main/java/seedu/address/model/ReadOnlyHealthWorkerBook.java b/src/main/java/seedu/address/model/ReadOnlyHealthWorkerBook.java new file mode 100644 index 000000000000..322f7c139919 --- /dev/null +++ b/src/main/java/seedu/address/model/ReadOnlyHealthWorkerBook.java @@ -0,0 +1,18 @@ +package seedu.address.model; + +import javafx.beans.Observable; +import javafx.collections.ObservableList; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * Unmodifiable view of HealthWorkerBook. + */ +public interface ReadOnlyHealthWorkerBook extends Observable { + + /** + * Returns an unmodifiable view of the healthworkers list. + * This list will not contain any duplicate healthworkers + */ + + ObservableList getHealthWorkerList(); +} diff --git a/src/main/java/seedu/address/model/ReadOnlyRequestBook.java b/src/main/java/seedu/address/model/ReadOnlyRequestBook.java new file mode 100644 index 000000000000..1db561799856 --- /dev/null +++ b/src/main/java/seedu/address/model/ReadOnlyRequestBook.java @@ -0,0 +1,15 @@ +package seedu.address.model; + +import javafx.beans.Observable; +import javafx.collections.ObservableList; +import seedu.address.model.request.Request; + +/** + * Unmodifiable view of a request book. + */ +public interface ReadOnlyRequestBook extends Observable { + /** + * @return an unmodifiable view of the request list. This list will not contain any duplicate requests. + */ + ObservableList getRequestList(); +} diff --git a/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java b/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java index befd58a4c739..7f6f050ceb09 100644 --- a/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java +++ b/src/main/java/seedu/address/model/ReadOnlyUserPrefs.java @@ -13,4 +13,8 @@ public interface ReadOnlyUserPrefs { Path getAddressBookFilePath(); + Path getRequestBookFilePath(); + + Path getHealthWorkerBookFilePath(); + } diff --git a/src/main/java/seedu/address/model/RequestBook.java b/src/main/java/seedu/address/model/RequestBook.java new file mode 100644 index 000000000000..d074fa47bcd5 --- /dev/null +++ b/src/main/java/seedu/address/model/RequestBook.java @@ -0,0 +1,159 @@ +package seedu.address.model; + +import static java.util.Objects.requireNonNull; + +import java.util.List; + +import javafx.beans.InvalidationListener; +import javafx.collections.ObservableList; +import seedu.address.commons.util.InvalidationListenerManager; +import seedu.address.model.request.Request; +import seedu.address.model.request.UniqueRequestList; + +/** + * Wraps all data at the request-book level + * Duplicates are not allowed (by .isSameRequest comparison) + * + * @@author daviddl9 + */ +public class RequestBook implements ReadOnlyRequestBook { + + private final UniqueRequestList requests = new UniqueRequestList(); + private final InvalidationListenerManager invalidationListenerManager = new InvalidationListenerManager(); + + public RequestBook() {} + + /** + * Creates a RequestBook using the Requests in the {@code toBeCopied} + */ + public RequestBook(ReadOnlyRequestBook toBeCopied) { + this(); + resetData(toBeCopied); + } + + //// list overwrite operations + + /** + * Replaces the contents of the request list with {@code requests}. + * {@code requests} must not contain duplicate requests. + */ + public void setRequests(List requests) { + this.requests.setRequests(requests); + indicateModified(); + } + + /** + * Resets the existing data of this {@code RequestBook} with {@code newData}. + */ + public void resetData(ReadOnlyRequestBook newData) { + requireNonNull(newData); + setRequests(newData.getRequestList()); + } + + //// request-level operations + + /** + * Returns true if a request with the same identity as {@code req} exists in the request book. + */ + public boolean hasRequest(Request req) { + requireNonNull(req); + return requests.contains(req); + } + + /** + * Returns true if this book has the same request identities of the requests in {@code other} + */ + public boolean areRequestsSame(RequestBook other) { + return this.requests.areRequestsSame(other.requests); + } + + /** + * Adds a request to the request book. + * The request must not already exist in the request book. + */ + public void addRequest(Request r) { + requests.add(r); + indicateModified(); + } + + /** + * Replaces the given request {@code target} in the list with {@code editedRequest}. + * {@code target} must exist in the request book. + * The request identity of {@code editedRequest} must not be the same as another existing + * request in the request book. + */ + public void setRequest(Request target, Request editedRequest) { + requireNonNull(editedRequest); + + requests.setRequest(target, editedRequest); + indicateModified(); + } + + /** + * Removes {@code key} from this {@code RequestBook}. + * {@code key} must exist in the request book. + */ + public void removeRequest(Request key) { + requests.remove(key); + indicateModified(); + } + + /** + * Updates the names of existing healthstaff in Request when the name field is updated in the HealthWorker objects. + */ + public void updateHealthWorker(String oldNric, String newNric) { + this.requests.updateHealthWorker(oldNric, newNric); + } + + /** + * @return an unmodifiable view of the request list. This list will not contain any duplicate requests. + */ + @Override + public ObservableList getRequestList() { + return requests.asUnmodifiableObservableList(); + } + + @Override + public void addListener(InvalidationListener listener) { + invalidationListenerManager.addListener(listener); + } + + @Override + public void removeListener(InvalidationListener listener) { + invalidationListenerManager.removeListener(listener); + } + + /** + * Notifies listeners that the request book has been modified. + */ + protected void indicateModified() { + invalidationListenerManager.callListeners(this); + } + + /** + * Checks if any Request in the UniqueRequestList contains the assigned HealthWorker name. + */ + public boolean isAssigned(String nric) { + return this.requests.isAssigned(nric); + } + + //// util methods + + @Override + public String toString() { + return requests.asUnmodifiableObservableList().toString(); + } + + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestBook // instanceof handles nulls + && requests.equals(((RequestBook) other).requests)); + } + + @Override + public int hashCode() { + return requests.hashCode(); + } +} diff --git a/src/main/java/seedu/address/model/UserPrefs.java b/src/main/java/seedu/address/model/UserPrefs.java index 25a5fd6eab9e..0e5055b7f636 100644 --- a/src/main/java/seedu/address/model/UserPrefs.java +++ b/src/main/java/seedu/address/model/UserPrefs.java @@ -15,6 +15,9 @@ public class UserPrefs implements ReadOnlyUserPrefs { private GuiSettings guiSettings = new GuiSettings(); private Path addressBookFilePath = Paths.get("data" , "addressbook.json"); + private Path requestBookFilePath = Paths.get("data" , "requestbook.json"); + private Path healthWorkerBookFilePath = Paths.get("data" , "healthworkerbook.json"); + /** * Creates a {@code UserPrefs} with default values. @@ -36,6 +39,8 @@ public void resetData(ReadOnlyUserPrefs newUserPrefs) { requireNonNull(newUserPrefs); setGuiSettings(newUserPrefs.getGuiSettings()); setAddressBookFilePath(newUserPrefs.getAddressBookFilePath()); + setHealthWorkerBookFilePath(newUserPrefs.getHealthWorkerBookFilePath()); + setRequestBookFilePath(newUserPrefs.getRequestBookFilePath()); } public GuiSettings getGuiSettings() { @@ -55,6 +60,24 @@ public void setAddressBookFilePath(Path addressBookFilePath) { requireNonNull(addressBookFilePath); this.addressBookFilePath = addressBookFilePath; } + public Path getRequestBookFilePath() { + return this.requestBookFilePath; + } + public void setRequestBookFilePath(Path requestBookFilePath) { + requireNonNull(requestBookFilePath); + this.requestBookFilePath = requestBookFilePath; + } + + public Path getHealthWorkerBookFilePath() { + return healthWorkerBookFilePath; + } + + public void setHealthWorkerBookFilePath(Path healthWorkerBookFilePath) { + requireNonNull(healthWorkerBookFilePath); + this.healthWorkerBookFilePath = healthWorkerBookFilePath; + } + + @Override public boolean equals(Object other) { @@ -68,7 +91,8 @@ public boolean equals(Object other) { UserPrefs o = (UserPrefs) other; return guiSettings.equals(o.guiSettings) - && addressBookFilePath.equals(o.addressBookFilePath); + && addressBookFilePath.equals(o.addressBookFilePath) + && requestBookFilePath.equals(o.requestBookFilePath); } @Override @@ -80,8 +104,11 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Gui Settings : " + guiSettings); - sb.append("\nLocal data file location : " + addressBookFilePath); + sb.append("\nAddress book Local data file location : " + addressBookFilePath); + sb.append("\nRequest book Local data file location : " + requestBookFilePath); + sb.append("\nHealthWorker book Local data file location : " + healthWorkerBookFilePath); return sb.toString(); } + } diff --git a/src/main/java/seedu/address/model/VersionedAddressBook.java b/src/main/java/seedu/address/model/VersionedAddressBook.java deleted file mode 100644 index e17a9e3ba4ab..000000000000 --- a/src/main/java/seedu/address/model/VersionedAddressBook.java +++ /dev/null @@ -1,110 +0,0 @@ -package seedu.address.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * {@code AddressBook} that keeps track of its own history. - */ -public class VersionedAddressBook extends AddressBook { - - private final List addressBookStateList; - private int currentStatePointer; - - public VersionedAddressBook(ReadOnlyAddressBook initialState) { - super(initialState); - - addressBookStateList = new ArrayList<>(); - addressBookStateList.add(new AddressBook(initialState)); - currentStatePointer = 0; - } - - /** - * Saves a copy of the current {@code AddressBook} state at the end of the state list. - * Undone states are removed from the state list. - */ - public void commit() { - removeStatesAfterCurrentPointer(); - addressBookStateList.add(new AddressBook(this)); - currentStatePointer++; - indicateModified(); - } - - private void removeStatesAfterCurrentPointer() { - addressBookStateList.subList(currentStatePointer + 1, addressBookStateList.size()).clear(); - } - - /** - * Restores the address book to its previous state. - */ - public void undo() { - if (!canUndo()) { - throw new NoUndoableStateException(); - } - currentStatePointer--; - resetData(addressBookStateList.get(currentStatePointer)); - } - - /** - * Restores the address book to its previously undone state. - */ - public void redo() { - if (!canRedo()) { - throw new NoRedoableStateException(); - } - currentStatePointer++; - resetData(addressBookStateList.get(currentStatePointer)); - } - - /** - * Returns true if {@code undo()} has address book states to undo. - */ - public boolean canUndo() { - return currentStatePointer > 0; - } - - /** - * Returns true if {@code redo()} has address book states to redo. - */ - public boolean canRedo() { - return currentStatePointer < addressBookStateList.size() - 1; - } - - @Override - public boolean equals(Object other) { - // short circuit if same object - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof VersionedAddressBook)) { - return false; - } - - VersionedAddressBook otherVersionedAddressBook = (VersionedAddressBook) other; - - // state check - return super.equals(otherVersionedAddressBook) - && addressBookStateList.equals(otherVersionedAddressBook.addressBookStateList) - && currentStatePointer == otherVersionedAddressBook.currentStatePointer; - } - - /** - * Thrown when trying to {@code undo()} but can't. - */ - public static class NoUndoableStateException extends RuntimeException { - private NoUndoableStateException() { - super("Current state pointer at start of addressBookState list, unable to undo."); - } - } - - /** - * Thrown when trying to {@code redo()} but can't. - */ - public static class NoRedoableStateException extends RuntimeException { - private NoRedoableStateException() { - super("Current state pointer at end of addressBookState list, unable to redo."); - } - } -} diff --git a/src/main/java/seedu/address/model/VersionedBook.java b/src/main/java/seedu/address/model/VersionedBook.java new file mode 100644 index 000000000000..781acde50ce3 --- /dev/null +++ b/src/main/java/seedu/address/model/VersionedBook.java @@ -0,0 +1,51 @@ +package seedu.address.model; + +/** + * @author Lookaz + * Interface that represents a ObjectBook that keeps track of changes. + */ +public interface VersionedBook { + + /** + * Saves a copy of the current state. + */ + void commit(); + + /** + * Restores its previous state. + */ + void undo(); + + /** + * Restores its previously undone state. + */ + void redo(); + + /** + * Returns true if {@code undo()} has states to undo. + */ + boolean canUndo(); + + /** + * Returns true if {@code redo()} has address book states to redo. + */ + boolean canRedo(); + + /** + * Thrown when trying to {@code undo()} but can't. + */ + class NoUndoableStateException extends RuntimeException { + protected NoUndoableStateException() { + super("Current state pointer at start of BookState list, unable to undo."); + } + } + + /** + * Thrown when trying to {@code redo()} but can't. + */ + class NoRedoableStateException extends RuntimeException { + protected NoRedoableStateException() { + super("Current state pointer at end of BookState list, unable to redo."); + } + } +} diff --git a/src/main/java/seedu/address/model/VersionedHealthWorkerBook.java b/src/main/java/seedu/address/model/VersionedHealthWorkerBook.java new file mode 100644 index 000000000000..7d1079ca69e1 --- /dev/null +++ b/src/main/java/seedu/address/model/VersionedHealthWorkerBook.java @@ -0,0 +1,80 @@ +package seedu.address.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * {@code HealthWorkerBook} that keeps track of its own history. + */ +public class VersionedHealthWorkerBook extends HealthWorkerBook implements VersionedBook { + + private final List healthWorkerBookStateList; + private int currStatePointer; + + public VersionedHealthWorkerBook(ReadOnlyHealthWorkerBook initialState) { + super(initialState); + + this.healthWorkerBookStateList = new ArrayList<>(); + this.healthWorkerBookStateList.add(new HealthWorkerBook(initialState)); + this.currStatePointer = 0; + } + + private void removeStatesAfterCurrentPointer() { + this.healthWorkerBookStateList.subList(this.currStatePointer + 1, + this.healthWorkerBookStateList.size()).clear(); + } + + @Override + public void commit() { + removeStatesAfterCurrentPointer(); + this.healthWorkerBookStateList.add(new HealthWorkerBook(this)); + this.currStatePointer++; + indicateModified(); + } + + @Override + public void undo() { + if (!canUndo()) { + throw new NoUndoableStateException(); + } + this.currStatePointer--; + resetData(this.healthWorkerBookStateList.get(this.currStatePointer)); + } + + @Override + public void redo() { + if (!canRedo()) { + throw new NoRedoableStateException(); + } + + this.currStatePointer++; + resetData(this.healthWorkerBookStateList.get(this.currStatePointer)); + } + + @Override + public boolean canUndo() { + return this.currStatePointer > 0; + } + + @Override + public boolean canRedo() { + return this.currStatePointer < this.healthWorkerBookStateList.size() - 1; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof VersionedHealthWorkerBook)) { + return false; + } + + VersionedHealthWorkerBook otherHealthWorkerBook = (VersionedHealthWorkerBook) other; + + return super.equals(otherHealthWorkerBook) + && this.healthWorkerBookStateList.equals(otherHealthWorkerBook.healthWorkerBookStateList) + && this.currStatePointer == otherHealthWorkerBook.currStatePointer; + } +} diff --git a/src/main/java/seedu/address/model/VersionedRequestBook.java b/src/main/java/seedu/address/model/VersionedRequestBook.java new file mode 100644 index 000000000000..6c305a4bb392 --- /dev/null +++ b/src/main/java/seedu/address/model/VersionedRequestBook.java @@ -0,0 +1,104 @@ +package seedu.address.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * {@code RequestBook} that keeps track of its own history. + * + * @@author daviddl9 + */ +public class VersionedRequestBook extends RequestBook implements VersionedBook { + + private final List requestBookStateList; + private int currentStatePointer; + + public VersionedRequestBook(ReadOnlyRequestBook initialState) { + super(initialState); + + requestBookStateList = new ArrayList<>(); + requestBookStateList.add(new RequestBook(initialState)); + currentStatePointer = 0; + } + + private void removeStatesAfterCurrentPointer() { + requestBookStateList.subList(currentStatePointer + 1, requestBookStateList.size()).clear(); + } + + @Override + public String toString() { + return "State: " + this.currentStatePointer + "\n" + this.requestBookStateList.toString(); + } + + /** + * Saves a copy of the current state. + */ + @Override + public void commit() { + removeStatesAfterCurrentPointer(); + requestBookStateList.add(new RequestBook(this)); + currentStatePointer++; + indicateModified(); + } + + /** + * Restores its previous state. + */ + @Override + public void undo() { + if (!canUndo()) { + throw new NoUndoableStateException(); + } + currentStatePointer--; + resetData(requestBookStateList.get(currentStatePointer)); + } + + /** + * Restores its previously undone state. + */ + @Override + public void redo() { + if (!canRedo()) { + throw new NoRedoableStateException(); + } + + this.currentStatePointer++; + resetData(this.requestBookStateList.get(this.currentStatePointer)); + } + + /** + * Returns true if {@code undo()} has states to undo. + */ + @Override + public boolean canUndo() { + return currentStatePointer > 0; + } + + /** + * Returns true if {@code redo()} has address book states to redo. + */ + @Override + public boolean canRedo() { + return currentStatePointer < requestBookStateList.size() - 1; + } + + @Override + public boolean equals(Object other) { + // short circuit if same object + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof VersionedRequestBook)) { + return false; + } + + VersionedRequestBook otherVersionedRequestBook = (VersionedRequestBook) other; + + // state check + return super.equals(otherVersionedRequestBook) && requestBookStateList + .equals(otherVersionedRequestBook.requestBookStateList) + && currentStatePointer == otherVersionedRequestBook.currentStatePointer; + } +} diff --git a/src/main/java/seedu/address/model/person/Address.java b/src/main/java/seedu/address/model/person/Address.java index 60472ca22a09..5d0ed43274b8 100644 --- a/src/main/java/seedu/address/model/person/Address.java +++ b/src/main/java/seedu/address/model/person/Address.java @@ -37,6 +37,25 @@ public static boolean isValidAddress(String test) { return test.matches(VALIDATION_REGEX); } + /** + * Extracts the street name from the address value, without the unit number. + * @return street A street only address. + */ + public String toStreetNameOnly() { + + // The address is either in one of the following formats: + // 123, ABC Road, #01-01 or 123 ABC Road, #01-01 or + // 123, ABC, Road, #01-01 or wallstreet + String street = value; + if (street.indexOf("#") != -1) { + street = value.substring(0, value.indexOf("#")); + } + if (street.indexOf(",") != -1) { + street = street.replaceAll(",", ""); + } + return street; + } + @Override public String toString() { return value; diff --git a/src/main/java/seedu/address/model/person/Email.java b/src/main/java/seedu/address/model/person/Email.java index a5bbe0b6a5fc..f452bc986ec0 100644 --- a/src/main/java/seedu/address/model/person/Email.java +++ b/src/main/java/seedu/address/model/person/Email.java @@ -9,6 +9,7 @@ */ public class Email { + public static final String DEFAULT_EMAIL = "default@gmail.com"; private static final String SPECIAL_CHARACTERS = "!#$%&'*+/=?`{|}~^.-"; public static final String MESSAGE_CONSTRAINTS = "Emails should be of the format local-part@domain " + "and adhere to the following constraints:\n" diff --git a/src/main/java/seedu/address/model/person/Name.java b/src/main/java/seedu/address/model/person/Name.java index 79244d71cf73..6c6f4dd15d74 100644 --- a/src/main/java/seedu/address/model/person/Name.java +++ b/src/main/java/seedu/address/model/person/Name.java @@ -10,7 +10,8 @@ public class Name { public static final String MESSAGE_CONSTRAINTS = - "Names should only contain alphanumeric characters and spaces, and it should not be blank"; + "Names should only contain alphabets and spaces, and " + + "it should not be blank"; /* * The first character of the address must not be a whitespace, @@ -18,7 +19,7 @@ public class Name { */ public static final String VALIDATION_REGEX = "[\\p{Alnum}][\\p{Alnum} ]*"; - public final String fullName; + private final String fullName; /** * Constructs a {@code Name}. @@ -38,6 +39,13 @@ public static boolean isValidName(String test) { return test.matches(VALIDATION_REGEX); } + /** + * Method that returns true if the full name contains the specified substring + */ + public boolean contains(String substring) { + return this.fullName.toLowerCase().contains(substring.toLowerCase()); + } + @Override public String toString() { diff --git a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java b/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java index c9b5868427ca..fc26d4ccec61 100644 --- a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java +++ b/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java @@ -18,7 +18,7 @@ public NameContainsKeywordsPredicate(List keywords) { @Override public boolean test(Person person) { return keywords.stream() - .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword)); + .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().toString(), keyword)); } @Override diff --git a/src/main/java/seedu/address/model/person/Nric.java b/src/main/java/seedu/address/model/person/Nric.java new file mode 100644 index 000000000000..72df60e3825a --- /dev/null +++ b/src/main/java/seedu/address/model/person/Nric.java @@ -0,0 +1,64 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Person's Nric to be represented. + * Guarantees Non-Null and is valid as declared in {@link #isValidNric(String)} + */ +public class Nric { + + public static final String MESSAGE_CONSTRAINTS = "Nric should start with " + + "an S or T, followed by 7 numeric characters and then a letter" + + ". All letters are to be in capital casing"; + public static final String VALIDATION_REGEX = "[STGF]\\d{7}[A-Z]"; // Nric + public static final String DEFAULT_NRIC = "S1234567A"; + // should start with capital S/T, followed by 7 numeric characters and a + // capital letter. + + private String nric; + + /** + * Constructs a {@code Nric}. + * + * @param nric A valid Nric. + */ + public Nric(String nric) { + requireNonNull(nric); + checkArgument(isValidNric(nric), MESSAGE_CONSTRAINTS); + this.nric = nric; + } + + /** + * Returns true if the Nric entered matches is valid. + * @param test Nric string to be tested + * @return true if test matches the validation regex + */ + public static boolean isValidNric(String test) { + return test.matches(VALIDATION_REGEX); + } + + /** + * Method that returns true if the nric field contains the specified substring, regardless of case + */ + public boolean contains(String substring) { + return this.nric.toLowerCase().contains(substring.toLowerCase()); + } + + @Override + public String toString() { + return this.nric; + } + + @Override + public int hashCode() { + return this.nric.hashCode(); + } + + @Override + public boolean equals(Object other) { + return this == other || (other instanceof Nric && this.nric.equals((( + Nric) other).nric)); + } +} diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 557a7a60cd51..d7f2e41f07d3 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -2,12 +2,7 @@ import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; -import java.util.Collections; -import java.util.HashSet; import java.util.Objects; -import java.util.Set; - -import seedu.address.model.tag.Tag; /** * Represents a Person in the address book. @@ -18,22 +13,16 @@ public class Person { // Identity fields private final Name name; private final Phone phone; - private final Email email; - - // Data fields - private final Address address; - private final Set tags = new HashSet<>(); + private final Nric nric; /** * Every field must be present and not null. */ - public Person(Name name, Phone phone, Email email, Address address, Set tags) { - requireAllNonNull(name, phone, email, address, tags); + public Person(Name name, Nric nric, Phone phone) { + requireAllNonNull(name, phone, nric); this.name = name; this.phone = phone; - this.email = email; - this.address = address; - this.tags.addAll(tags); + this.nric = nric; } public Name getName() { @@ -44,24 +33,12 @@ public Phone getPhone() { return phone; } - public Email getEmail() { - return email; - } - - public Address getAddress() { - return address; + public Nric getNric() { + return nric; } /** - * Returns an immutable tag set, which throws {@code UnsupportedOperationException} - * if modification is attempted. - */ - public Set getTags() { - return Collections.unmodifiableSet(tags); - } - - /** - * Returns true if both persons of the same name have at least one other identity field that is the same. + * Returns true if both persons of the same name have thesame nric. * This defines a weaker notion of equality between two persons. */ public boolean isSamePerson(Person otherPerson) { @@ -71,7 +48,7 @@ public boolean isSamePerson(Person otherPerson) { return otherPerson != null && otherPerson.getName().equals(getName()) - && (otherPerson.getPhone().equals(getPhone()) || otherPerson.getEmail().equals(getEmail())); + && otherPerson.getNric().equals(getNric()); } /** @@ -91,29 +68,24 @@ public boolean equals(Object other) { Person otherPerson = (Person) other; return otherPerson.getName().equals(getName()) && otherPerson.getPhone().equals(getPhone()) - && otherPerson.getEmail().equals(getEmail()) - && otherPerson.getAddress().equals(getAddress()) - && otherPerson.getTags().equals(getTags()); + && otherPerson.getNric().equals(getNric()); } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, address, tags); + return Objects.hash(name, phone, nric); } @Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append(getName()) + .append(" Nric: ") + .append(getNric()) .append(" Phone: ") - .append(getPhone()) - .append(" Email: ") - .append(getEmail()) - .append(" Address: ") - .append(getAddress()) - .append(" Tags: "); - getTags().forEach(builder::append); + .append(getPhone()); + return builder.toString(); } diff --git a/src/main/java/seedu/address/model/person/Phone.java b/src/main/java/seedu/address/model/person/Phone.java index 872c76b382fd..96099be651a1 100644 --- a/src/main/java/seedu/address/model/person/Phone.java +++ b/src/main/java/seedu/address/model/person/Phone.java @@ -11,8 +11,8 @@ public class Phone { public static final String MESSAGE_CONSTRAINTS = - "Phone numbers should only contain numbers, and it should be at least 3 digits long"; - public static final String VALIDATION_REGEX = "\\d{3,}"; + "Phone numbers should only contain numbers, and should be 8 digits long starting with 6, 8 or 9."; + public static final String VALIDATION_REGEX = "[689][0-9]{7}"; public final String value; /** diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/seedu/address/model/person/UniquePersonList.java index 0fee4fe57e6b..0aee2fae4c17 100644 --- a/src/main/java/seedu/address/model/person/UniquePersonList.java +++ b/src/main/java/seedu/address/model/person/UniquePersonList.java @@ -121,6 +121,11 @@ public int hashCode() { return internalList.hashCode(); } + public Person getAt(int index) { + assert(index < this.internalList.size() - 1); + return this.internalList.get(index); + } + /** * Returns true if {@code persons} contains only unique persons. */ diff --git a/src/main/java/seedu/address/model/person/healthworker/HealthWorker.java b/src/main/java/seedu/address/model/person/healthworker/HealthWorker.java new file mode 100644 index 000000000000..f37816e6aa59 --- /dev/null +++ b/src/main/java/seedu/address/model/person/healthworker/HealthWorker.java @@ -0,0 +1,103 @@ +package seedu.address.model.person.healthworker; + +import java.util.Objects; + +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.tag.Skills; +import seedu.address.model.tag.Specialisation; + +/** + * Represents a Health Worker class that can handle requests. + * Guarantees: details are present and not null, and field values are validated. + */ +public class HealthWorker extends Person { + + private Organization organization; + private Skills skills; + + public HealthWorker(HealthWorker toCopy) { + super(toCopy.getName(), toCopy.getNric(), toCopy.getPhone()); + this.organization = toCopy.getOrganization(); + this.skills = toCopy.getSkills(); + } + + public HealthWorker(Name name, Nric nric, Phone phone, Organization organization, Skills skills) { + super(name, nric, phone); + this.organization = organization; + this.skills = skills; + } + + public Organization getOrganization() { + return organization; + } + + public Skills getSkills() { + return skills; + } + + /** + * Checks if the current HealthWorker object has the specified + * specialisation + * @param specialisation to check for + * @return true if the HealthWorker object contains the specialisation in + * Skills, false otherwise. + */ + public boolean hasSkill(Specialisation specialisation) { + return this.skills.contains(specialisation); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append(getName()) + .append(" Nric: ") + .append(getNric()) + .append(" Organization: ") + .append(getOrganization().toString()) + .append(" Phone: ") + .append(getPhone()) + .append(" Skills: ") + .append(getSkills()); + return builder.toString(); + } + + /** + * Returns true if both HealthWorkers have the same name, nric, phone and + * organization. + * This defines a weaker notion of equality between two persons. + */ + public boolean isSameHealthWorker(HealthWorker other) { + if (other == this) { + return true; + } + + return other != null + && other.getNric().equals(this.getNric()); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof HealthWorker)) { + return false; + } + + HealthWorker otherHealthWorker = (HealthWorker) other; + return otherHealthWorker.getName().equals(getName()) + && otherHealthWorker.getPhone().equals(getPhone()) + && otherHealthWorker.getNric().equals(getNric()) + && otherHealthWorker.getOrganization().equals(getOrganization()) + && otherHealthWorker.getSkills().equals(getSkills()); + } + + @Override + public int hashCode() { + return Objects.hash(getName(), getNric(), getPhone(), getOrganization(), getSkills()); + } +} diff --git a/src/main/java/seedu/address/model/person/healthworker/Organization.java b/src/main/java/seedu/address/model/person/healthworker/Organization.java new file mode 100644 index 000000000000..57c84fcf0297 --- /dev/null +++ b/src/main/java/seedu/address/model/person/healthworker/Organization.java @@ -0,0 +1,56 @@ +package seedu.address.model.person.healthworker; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Health Worker's Organization. + * Guarantees: immutable; is valid as declared in {@link #isValidOrgName(String)} + */ +public class Organization { + + public static final String MESSAGE_CONSTRAINTS = "Organization name " + + "should contain only alphanumeric characters and spaces"; + public static final String VALIDATION_REGEX = + "^[a-zA-Z0-9]+( [a-zA-Z0-9]+)*$"; // Organization name should + // contain only alphanumeric character strings with spaces in between. + + private String orgName; + + public Organization(String orgName) { + requireNonNull(orgName); + checkArgument(isValidOrgName(orgName), MESSAGE_CONSTRAINTS); + this.orgName = orgName; + } + + public static boolean isValidOrgName(String test) { + return test.matches(VALIDATION_REGEX); + } + + /** + * Method that returns true if organization name contains the specified substring. + */ + public boolean contains(String substring) { + return this.orgName.toLowerCase().contains(substring.toLowerCase()); + } + + public String getOrgName() { + return orgName; + } + + @Override + public String toString() { + return getOrgName(); + } + + @Override + public int hashCode() { + return this.orgName.hashCode(); + } + + @Override + public boolean equals(Object other) { + return other == this || (other instanceof Organization && this + .orgName.equals(((Organization) other).orgName)); + } +} diff --git a/src/main/java/seedu/address/model/person/healthworker/UniqueHealthWorkerList.java b/src/main/java/seedu/address/model/person/healthworker/UniqueHealthWorkerList.java new file mode 100644 index 000000000000..3166bb397df3 --- /dev/null +++ b/src/main/java/seedu/address/model/person/healthworker/UniqueHealthWorkerList.java @@ -0,0 +1,151 @@ +package seedu.address.model.person.healthworker; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + +import java.util.Iterator; +import java.util.List; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import seedu.address.model.person.exceptions.DuplicatePersonException; +import seedu.address.model.person.exceptions.PersonNotFoundException; + +/** + * @author Lookaz + * + * A list of HealthWorker objects that enforces uniqueness between its elements + * and does not allow nulls. A person is considered unique by comparing using + * {@code HealthWorker#isSameHealthWorker(HealthWorker)}. As such, adding and + * updating of HealthWorkers uses HealthWorker#isSameHealthWorker(HealthWorker) + * for equality so as to ensure that the HealthWorker being added or updated is + * unique in terms of identity in the UniqueHealthWorkerList. However, the + * removal of a person uses HealthWorker#equals(HealthWorker) so + * as to ensure that the person with exactly the same fields will be removed. + * + * Supports a minimal set of list operations. + * + * @see HealthWorker#isSameHealthWorker(HealthWorker) + */ +public class UniqueHealthWorkerList implements Iterable { + + private final ObservableList internalList = FXCollections + .observableArrayList(); + private final ObservableList internalUnmodifiableList = + FXCollections.unmodifiableObservableList(internalList); + + /** + * Returns true if the list contains an equivalent HealthWorker as the + * given argument. + */ + public boolean contains(HealthWorker toCheck) { + requireNonNull(toCheck); + return this.internalList.stream().anyMatch(toCheck::isSameHealthWorker); + } + + /** + * Adds a HealthWorker to the list. + * The person must not already exist in the list. + */ + public void add(HealthWorker toAdd) { + requireNonNull(toAdd); + if (contains(toAdd)) { + throw new DuplicatePersonException(); + } + this.internalList.add(toAdd); + } + + /** + * Replaces the HealthWorker {@code target} in the list with {@code edited}. + * {@code target} must exist in the list. + * The person identity of {@code edited} must not be the same as another + * existing HealthWorker in the list. + */ + public void setHealthWorker(HealthWorker target, HealthWorker edited) { + requireAllNonNull(target, edited); + + int index = this.internalList.indexOf(target); + if (index == -1) { + throw new PersonNotFoundException(); + } + + if (!target.isSameHealthWorker(edited) && contains(edited)) { + throw new DuplicatePersonException(); + } + + this.internalList.set(index, edited); + } + + /** + * Removes the equivalent HealthWorker from the list. + * The HealthWorker must exist in the list. + */ + public void remove(HealthWorker toRemove) { + requireNonNull(toRemove); + if (!this.internalList.remove(toRemove)) { + throw new PersonNotFoundException(); + } + } + + public void setHealthWorkers(UniqueHealthWorkerList replacement) { + requireNonNull(replacement); + this.internalList.setAll(replacement.internalList); + } + + /** + * Replaces the contents of this list with {@code healthWorkers}. + * {@code healthWorkers} must not contain duplicate persons. + */ + public void setHealthWorkers(List healthWorkers) { + requireAllNonNull(healthWorkers); + if (!workersAreUnique(healthWorkers)) { + throw new DuplicatePersonException(); + } + + this.internalList.setAll(healthWorkers); + } + + /** + * Returns the backing list as an unmodifiable {@code ObservableList}. + */ + public ObservableList asUnmodifiableObservableList() { + return this.internalUnmodifiableList; + } + + @Override + public Iterator iterator() { + return this.internalList.iterator(); + } + + @Override + public int hashCode() { + return this.internalList.hashCode(); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof UniqueHealthWorkerList // instanceof handles nulls + && this.internalList.equals(((UniqueHealthWorkerList) other).internalList)); + } + + /** + * Returns true if {@code persons} contains only unique HealthWorkers. + */ + private boolean workersAreUnique(List workers) { + for (int i = 0; i < workers.size() - 1; i++) { + for (int j = i + 1; j < workers.size(); j++) { + if (workers.get(i).isSameHealthWorker(workers.get(j))) { + return false; + } + } + } + return true; + } + + public HealthWorker getAt(int index) { + assert(index < this.internalList.size() - 1); + return this.internalList.get(index); + } + +} diff --git a/src/main/java/seedu/address/model/person/healthworker/exceptions/HealthWorkerNotFoundException.java b/src/main/java/seedu/address/model/person/healthworker/exceptions/HealthWorkerNotFoundException.java new file mode 100644 index 000000000000..d3a4f7f48cbb --- /dev/null +++ b/src/main/java/seedu/address/model/person/healthworker/exceptions/HealthWorkerNotFoundException.java @@ -0,0 +1,8 @@ +package seedu.address.model.person.healthworker.exceptions; + +/** + * Signals that the operation is unable to find the specified health worker. + * @author Hui Chun + */ +public class HealthWorkerNotFoundException extends RuntimeException {} + diff --git a/src/main/java/seedu/address/model/request/Request.java b/src/main/java/seedu/address/model/request/Request.java new file mode 100644 index 000000000000..19db9b9ee250 --- /dev/null +++ b/src/main/java/seedu/address/model/request/Request.java @@ -0,0 +1,222 @@ +package seedu.address.model.request; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + +import java.util.Objects; +import java.util.Set; + +import seedu.address.model.person.Address; +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Phone; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.tag.Condition; + +/** + * Represents a request made by a patient in the request book. + * + * @@author daviddl9 + */ +public class Request { + + private final Name name; + private final Nric nric; + private final Address address; + private final Phone phone; + private final RequestDate requestDate; + private Set conditions; + private String healthWorker = null; + private RequestStatus requestStatus; + + /** + * Overloaded constructor that takes in differing arguments for the patient. + */ + public Request(Name name, Nric nric, Phone phone, Address address, RequestDate requestDate, + Set conditions, RequestStatus status) { + requireAllNonNull(name, phone, nric, address, requestDate, conditions, status); + this.phone = phone; + this.conditions = conditions; + this.requestStatus = status; + this.requestDate = requestDate; + this.name = name; + this.nric = nric; + this.address = address; + } + + /** + * Constructor that takes in a {@code Request} object and copies over it's values. + */ + public Request(Request toCopy) { + requireNonNull(toCopy); + this.phone = toCopy.getPhone(); + this.conditions = toCopy.getConditions(); + this.requestStatus = toCopy.getRequestStatus(); + this.requestDate = toCopy.getRequestDate(); + this.name = toCopy.getName(); + this.nric = toCopy.getNric(); + this.address = toCopy.getAddress(); + this.healthWorker = toCopy.getHealthStaff(); + } + + /** + * Simplified constructor that takes in the minimal arguments to form a {@code Request} + *

+ * Sets the {@code requestStatus} to pending + */ + public Request(Name name, Nric nric, Phone phone, Address address, RequestDate requestDate, + Set conditions) { + requireAllNonNull(name, nric, address, requestDate, conditions, phone); + this.phone = phone; + this.conditions = conditions; + this.requestStatus = new RequestStatus("PENDING"); + this.name = name; + this.nric = nric; + this.requestDate = requestDate; + this.address = address; + } + + /** + * Overloaded constructor to represent a request. + */ + public Request(Name name, Nric nric, Phone phone, Address address, RequestDate requestDate, + Set conditions, RequestStatus status, String healthWorker) { + requireAllNonNull(name, address, phone, requestDate, conditions, status); + this.phone = phone; + this.conditions = conditions; + this.requestStatus = status; + this.requestDate = requestDate; + this.healthWorker = healthWorker; + this.name = name; + this.nric = nric; + this.address = address; + } + + + /** + * Returns true if both requests of the same ID and date have at least one other + * property field that is the same. + * This defines a weaker notion of equality between two requests. + */ + public boolean isSameRequest(Request otherRequest) { + if (otherRequest == this) { + return true; + } + + if (otherRequest == null) { + return false; + } + + return otherRequest.nric.equals(this.nric) + && otherRequest.getRequestDate().equals(this.requestDate) + && otherRequest.getConditions().equals(this.conditions) + && otherRequest.address.equals(this.address); + } + + public Name getName() { + return this.name; + } + + public Address getAddress() { + return this.address; + } + + public Nric getNric() { + return this.nric; + } + + @Override + public String toString() { + String hw = (healthWorker == null) ? "Unassigned" : healthWorker; + final StringBuilder builder = new StringBuilder(); + builder.append("\n----------Request----------\n") + .append("Name: ") + .append(getName() + "\n") + .append("Nric: ") + .append(getNric() + "\n") + .append("Phone: ") + .append(getPhone() + "\n") + .append("Address: ") + .append(getAddress() + "\n") + .append("Assigned staff: ") + .append(hw + "\n") + .append("Request Date: ") + .append(getRequestDate() + "\n") + .append("Condition(s): "); + builder.append(getConditions() + "\n") + .append("Status: ") + .append(getRequestStatus() + "\n") + .append("----------End of Request----------\n"); + return builder.toString(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof Request)) { + return false; + } + + Request otherRequest = (Request) other; + return (otherRequest.getRequestDate().equals(this.requestDate)) + && (otherRequest.name.equals(this.name)) + && (otherRequest.address.equals(this.address)) + && (otherRequest.phone.equals(this.phone)) + && (otherRequest.nric.equals(this.nric)) + && (otherRequest.getConditions().equals(this.conditions)) + && (Objects.equals(this.healthWorker, otherRequest.getHealthStaff())) + && (otherRequest.getRequestStatus().equals(this.requestStatus)); + } + + public Set getConditions() { + return this.conditions; + } + + public RequestStatus getRequestStatus() { + return this.requestStatus; + } + + public RequestDate getRequestDate() { + return this.requestDate; + } + + public String getHealthStaff() { + return healthWorker; + } + + public void setRequestStatus(RequestStatus status) { + requireNonNull(status); + this.requestStatus = new RequestStatus(status.toString()); + } + + public void setHealthStaff(String healthStaff) { + requireNonNull(healthStaff); + this.healthWorker = healthStaff; + this.requestStatus = new RequestStatus("ONGOING"); + } + + public void setHealthWorker(HealthWorker healthWorker) { + requireNonNull(healthWorker); + this.healthWorker = healthWorker.getNric().toString(); + this.requestStatus = new RequestStatus("ONGOING"); + } + + public boolean isOngoingStatus() { + return this.requestStatus.isOngoingStatus(); + } + + public boolean isCompleted() { + return this.requestStatus.isCompletedStatus(); + } + + public Phone getPhone() { + return phone; + } + + public void complete() { + this.requestStatus = new RequestStatus("COMPLETED"); + } +} diff --git a/src/main/java/seedu/address/model/request/RequestAddressContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestAddressContainsKeywordPredicate.java new file mode 100644 index 000000000000..40da64109ab4 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestAddressContainsKeywordPredicate.java @@ -0,0 +1,29 @@ +package seedu.address.model.request; + +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Address} matches any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestAddressContainsKeywordPredicate implements Predicate { + private final String keyword; + + public RequestAddressContainsKeywordPredicate(String address) { + keyword = address.trim().toLowerCase(); + } + + @Override + public boolean test(Request request) { + return request.getAddress().value.toLowerCase().contains(keyword); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestAddressContainsKeywordPredicate // instanceof handles nulls + && keyword.equals(((RequestAddressContainsKeywordPredicate) other).keyword)); // state check + } + +} diff --git a/src/main/java/seedu/address/model/request/RequestConditionContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestConditionContainsKeywordPredicate.java new file mode 100644 index 000000000000..39316a5182d9 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestConditionContainsKeywordPredicate.java @@ -0,0 +1,29 @@ +package seedu.address.model.request; + +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Condition} matches any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestConditionContainsKeywordPredicate implements Predicate { + private final String keyword; + + public RequestConditionContainsKeywordPredicate(String condition) { + keyword = condition.trim().toLowerCase(); + } + + @Override + public boolean test(Request request) { + return request.getConditions().stream() + .anyMatch(condition -> condition.toString().toLowerCase().contains(keyword)); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestConditionContainsKeywordPredicate // instanceof handles nulls + && keyword.equals(((RequestConditionContainsKeywordPredicate) other).keyword)); // state check + } +} diff --git a/src/main/java/seedu/address/model/request/RequestDate.java b/src/main/java/seedu/address/model/request/RequestDate.java new file mode 100644 index 000000000000..1ed74488284d --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestDate.java @@ -0,0 +1,82 @@ +package seedu.address.model.request; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Represents a Request's date in the request book. + * Guarantees: immutable + * + * @@author daviddl9 + */ +public class RequestDate { + + public static final String MESSAGE_CONSTRAINTS = "Date should be in the format dd-MM-yyyy HH:mm:ss and it " + + "should be a valid date."; + + private static final SimpleDateFormat sf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + + private Date date = null; + + /** + * Constructs a {@code RequestDate}. + * + * @param requestDate A valid Request Date. + */ + public RequestDate(String requestDate) { + + requireNonNull(requestDate); + + try { + sf.setLenient(false); + date = sf.parse(requestDate); + } catch (ParseException e) { + checkArgument(false, MESSAGE_CONSTRAINTS); + } + } + + /** + * @param orderDate The date to check for validity. + * @return true if the orderDate is valid, false otherwise. + */ + public static boolean isValidDate(String orderDate) { + try { + sf.setLenient(false); + sf.parse(orderDate); + return true; + } catch (ParseException e) { + return false; + } + } + + public Date getDate() { + return this.date; + } + + public String getFormattedDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-YYYY, hh:mm a"); + return dateFormat.format(this.date); + } + + @Override + public String toString() { + return sf.format(this.date); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestDate // instanceof handles nulls + && date.equals(((RequestDate) other).date)); // state check + } + + @Override + public int hashCode() { + return date.hashCode(); + } + +} diff --git a/src/main/java/seedu/address/model/request/RequestDatePredicate.java b/src/main/java/seedu/address/model/request/RequestDatePredicate.java new file mode 100644 index 000000000000..1aecce2b17a3 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestDatePredicate.java @@ -0,0 +1,44 @@ +package seedu.address.model.request; + +import java.util.Date; +import java.util.List; +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Date} matches any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestDatePredicate implements Predicate { + public static final int VALID_SEARCH_DATE_RANGE_SIZE = 2; + public static final int LOWER_DATE_RANGE_INDEX = 0; + public static final int UPPER_DATE_RANGE_INDEX = 1; + + private Predicate datePredicate; + + public RequestDatePredicate(List dates) { + assert dates.size() < 3; + + if (dates.size() == VALID_SEARCH_DATE_RANGE_SIZE) { + Date lowerDateBoundary = dates.get(LOWER_DATE_RANGE_INDEX); + Date upperDateBoundary = dates.get(UPPER_DATE_RANGE_INDEX); + assert (lowerDateBoundary.before(upperDateBoundary) && lowerDateBoundary != upperDateBoundary); + datePredicate = new RequestDateRangePredicate(lowerDateBoundary, upperDateBoundary); + } else { + // One date in list + datePredicate = new RequestDateSinglePredicate(dates.get(0)); + } + } + + @Override + public boolean test(Request request) { + return datePredicate.test(request); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestDatePredicate // instanceof handles nulls + && datePredicate.equals(((RequestDatePredicate) other).datePredicate)); // state check + } +} diff --git a/src/main/java/seedu/address/model/request/RequestDateRangePredicate.java b/src/main/java/seedu/address/model/request/RequestDateRangePredicate.java new file mode 100644 index 000000000000..61e4102b013b --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestDateRangePredicate.java @@ -0,0 +1,37 @@ +package seedu.address.model.request; + +import java.util.Date; +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Date} is within the 2 dates given. + * + * @@author daviddl9 + */ +public class RequestDateRangePredicate implements Predicate { + private final Date lowerDateBoundary; + private final Date upperDateBoundary; + + public RequestDateRangePredicate(Date lowerDateBoundary, Date upperDateBoundary) { + this.lowerDateBoundary = lowerDateBoundary; + this.upperDateBoundary = upperDateBoundary; + } + + @Override + public boolean test(Request request) { + return isWithinDateBoundary(request.getRequestDate().getDate()); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestDateRangePredicate // instanceof handles nulls + && lowerDateBoundary.equals(((RequestDateRangePredicate) other).lowerDateBoundary) + && upperDateBoundary.equals(((RequestDateRangePredicate) other).upperDateBoundary)); // state check + } + + private boolean isWithinDateBoundary(Date date) { + return (date.equals(lowerDateBoundary) || date.equals(upperDateBoundary) + || (date.after(lowerDateBoundary) && date.before(upperDateBoundary))); + } +} diff --git a/src/main/java/seedu/address/model/request/RequestDateSinglePredicate.java b/src/main/java/seedu/address/model/request/RequestDateSinglePredicate.java new file mode 100644 index 000000000000..2cdf6c0eccd8 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestDateSinglePredicate.java @@ -0,0 +1,30 @@ +package seedu.address.model.request; + +import java.util.Date; +import java.util.function.Predicate; + + +/** + * Tests that a {@code Request}'s {@code Date} matches any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestDateSinglePredicate implements Predicate { + private final Date keyword; + + public RequestDateSinglePredicate(Date date) { + keyword = date; + } + + @Override + public boolean test(Request request) { + return request.getRequestDate().getDate().equals(keyword); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestDateSinglePredicate // instanceof handles nulls + && keyword.equals(((RequestDateSinglePredicate) other).keyword)); // state check + } +} diff --git a/src/main/java/seedu/address/model/request/RequestNameContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestNameContainsKeywordPredicate.java new file mode 100644 index 000000000000..e6427855b248 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestNameContainsKeywordPredicate.java @@ -0,0 +1,28 @@ +package seedu.address.model.request; + +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Name} contains any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestNameContainsKeywordPredicate implements Predicate { + private final String keyword; + + public RequestNameContainsKeywordPredicate(String name) { + this.keyword = name.trim().toLowerCase(); + } + + @Override + public boolean test(Request request) { + return request.getName().toString().toLowerCase().contains(keyword); + } + + @Override + public boolean equals(Object other) { + return other == this + || (other instanceof RequestNameContainsKeywordPredicate + && keyword.equals(((RequestNameContainsKeywordPredicate) other).keyword)); + } +} diff --git a/src/main/java/seedu/address/model/request/RequestNricContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestNricContainsKeywordPredicate.java new file mode 100644 index 000000000000..00a33de1b1a0 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestNricContainsKeywordPredicate.java @@ -0,0 +1,28 @@ +package seedu.address.model.request; + +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Nric} contains any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestNricContainsKeywordPredicate implements Predicate { + private final String keyword; + + public RequestNricContainsKeywordPredicate(String nric) { + keyword = nric.trim().toLowerCase(); + } + + @Override + public boolean test(Request request) { + return request.getNric().toString().toLowerCase().contains(keyword); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestNricContainsKeywordPredicate // instanceof handles nulls + && keyword.equals(((RequestNricContainsKeywordPredicate) other).keyword)); // state check + } +} diff --git a/src/main/java/seedu/address/model/request/RequestPhoneContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestPhoneContainsKeywordPredicate.java new file mode 100644 index 000000000000..33414bf4fcab --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestPhoneContainsKeywordPredicate.java @@ -0,0 +1,30 @@ +package seedu.address.model.request; + +import java.util.List; +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code Phone} matches any of the keywords given. + * + * @@author daviddl9 + */ +public class RequestPhoneContainsKeywordPredicate implements Predicate { + private final List keywords; + + public RequestPhoneContainsKeywordPredicate(List phone) { + keywords = phone; + } + + @Override + public boolean test(Request request) { + return keywords.stream().anyMatch(keyword -> request.getPhone().value.contains(keyword)); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestPhoneContainsKeywordPredicate // instanceof handles nulls + && keywords.equals(((RequestPhoneContainsKeywordPredicate) other).keywords)); // state check + } + +} diff --git a/src/main/java/seedu/address/model/request/RequestStatus.java b/src/main/java/seedu/address/model/request/RequestStatus.java new file mode 100644 index 000000000000..1d6fb9ac10a9 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestStatus.java @@ -0,0 +1,83 @@ +package seedu.address.model.request; + +/** + * Represents an Request's status in the request book. + * Guarantees: immutable + * + * @@author daviddl9 + */ +public class RequestStatus { + + public static final String MESSAGE_STATUS_CONSTRAINTS = "Status should be either: PENDING, ONGOING or COMPLETED"; + + /** + * Represents the different possible statuses of a request. + */ + private enum Status { + PENDING, + ONGOING, + COMPLETED + } + + private Status requestState = null; + + /** + * Constructs a {@code RequestStatus}. + */ + public RequestStatus() { + this(Status.PENDING.name()); + } + + /** + * Constructs a {@code RequestStatus} with a parameter. + * + * @param status a valid request status + */ + public RequestStatus(String status) { + this.requestState = Status.valueOf(status); + } + + /** + * @return true if the status is ongoing, false otherwise. + */ + public boolean isOngoingStatus() { + return this.requestState.equals(Status.ONGOING); + } + + /** + * @return true if status is completed, false otherwise. + */ + public boolean isCompletedStatus() { + return this.requestState.equals(Status.COMPLETED); + } + + /** + * @param requestStatus The status to be checked for validity. + * @return true if the requestStatus is valid, false otherwise. + */ + public static boolean isValidStatus(String requestStatus) { + for (Status s : Status.values()) { + if (requestStatus.equals(s.name())) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return this.requestState.toString(); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestStatus // instanceof handles nulls + && this.requestState.equals(((RequestStatus) other).requestState)); // state check + } + + @Override + public int hashCode() { + return this.requestState.hashCode(); + } +} diff --git a/src/main/java/seedu/address/model/request/RequestStatusContainsKeywordPredicate.java b/src/main/java/seedu/address/model/request/RequestStatusContainsKeywordPredicate.java new file mode 100644 index 000000000000..c2c34ef1bfe8 --- /dev/null +++ b/src/main/java/seedu/address/model/request/RequestStatusContainsKeywordPredicate.java @@ -0,0 +1,30 @@ +package seedu.address.model.request; + +import java.util.List; +import java.util.function.Predicate; + +/** + * Tests that a {@code Request}'s {@code RequestStatus} matches the keywords given. + * + * @@author daviddl9 + */ +public class RequestStatusContainsKeywordPredicate implements Predicate { + private final List keywords; + + public RequestStatusContainsKeywordPredicate(List statuses) { + keywords = statuses; + } + + @Override + public boolean test(Request request) { + return keywords.stream() + .anyMatch(keyword -> request.getRequestStatus().equals(keyword)); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof RequestStatusContainsKeywordPredicate // instanceof handles nulls + && keywords.equals(((RequestStatusContainsKeywordPredicate) other).keywords)); // state check + } +} diff --git a/src/main/java/seedu/address/model/request/UniqueRequestList.java b/src/main/java/seedu/address/model/request/UniqueRequestList.java new file mode 100644 index 000000000000..6de827ca680f --- /dev/null +++ b/src/main/java/seedu/address/model/request/UniqueRequestList.java @@ -0,0 +1,187 @@ +package seedu.address.model.request; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import seedu.address.model.request.exceptions.DuplicateRequestException; +import seedu.address.model.request.exceptions.RequestNotFoundException; + +/** + * A list of requests that enforces uniqueness between its elements and does not allow nulls. + * An order is considered unique by comparison using {@code Request#isSameRequest(Request)}. As such, adding and + * updating of orders uses Request#isSameRequest(Request) for equality so as to ensure that the Request being added or + * updated is unique in terms of identity in the UniqueRequestList. However, the removal of a Request uses + * Request#equals(Object) so as to ensure that the request with the same fields will be removed. + * + * Supports a minimal set of list operations. + * + * @see Request#isSameRequest(Request) + * + * @@author daviddl9 + */ +public class UniqueRequestList implements Iterable { + + private final ObservableList internalList = FXCollections.observableArrayList(); + + /** + * Returns true if the list contains an equivalent order as the given argument. + */ + public boolean contains(Request toCheck) { + requireNonNull(toCheck); + return internalList.stream().anyMatch(toCheck::isSameRequest); + } + + /** + * Adds an order to the list. + * The order must not already exist in the list. + */ + public void add(Request toAdd) { + requireNonNull(toAdd); + if (contains(toAdd)) { + throw new DuplicateRequestException(); + } + internalList.add(toAdd); + } + + /** + * Replaces the order {@code target} in the list with {@code editedRequest}. + * {@code target} must exist in the list. + * {@code editedRequest} must not be the same as any other request in the list (by Request#isSameRequest(Request) + * comparison). + */ + public void setRequest(Request target, Request editedRequest) { + requireAllNonNull(target, editedRequest); + + int index = internalList.indexOf(target); + if (index == -1) { + throw new RequestNotFoundException(); + } + + if (!target.isSameRequest(editedRequest) && contains(editedRequest)) { + throw new DuplicateRequestException(); + } + + internalList.set(index, editedRequest); + } + + public void setRequests(UniqueRequestList replacement) { + requireNonNull(replacement); + internalList.setAll(replacement.internalList); + } + + /** + * Replaces the contents of this list with {@code requests}. + * {@code requests} must not contain duplicate persons. + */ + public void setRequests(List requests) { + requireAllNonNull(requests); + if (!requestsAreUnique(requests)) { + throw new DuplicateRequestException(); + } + internalList.setAll(requests); + } + + /** + * Returns true if all the contents in {@code requests} are unique, false otherwise. + */ + private boolean requestsAreUnique(List requests) { + for (int i = 0; i < requests.size() - 1; i++) { + for (int j = i + 1; j < requests.size(); j++) { + if (requests.get(i).isSameRequest(requests.get(j))) { + return false; + } + } + } + return true; + } + + /** + * Checks if 2 request lists are the same. + */ + public boolean areRequestsSame(UniqueRequestList requests) { + if (this.internalList.size() != requests.internalList.size()) { + return false; + } + for (int i = 0; i < requests.internalList.size(); i++) { + if (!(this.internalList.get(i).isSameRequest(requests.internalList.get(i)))) { + return false; + } + } + return true; + } + + /** + * Removes the equivalent order from the list. + * The request must exist in the list. + */ + public void remove(Request toRemove) { + requireNonNull(toRemove); + if (!internalList.remove(toRemove)) { + throw new RequestNotFoundException(); + } + } + + /** + * Returns the backing list as an unmodifiable {@code ObservableList}. + */ + public ObservableList asUnmodifiableObservableList() { + return FXCollections.unmodifiableObservableList(internalList); + } + + /** + * Checks if any Request in the UniqueRequestList contains the assigned HealthWorker nric. + */ + public boolean isAssigned(String nric) { + return this.internalList.stream().anyMatch(x -> Objects.equals(nric, x.getHealthStaff()) + && x.getRequestStatus().isOngoingStatus()); + } + + /** + * Updates the healthStaff field in Request object when the name of the correposnding HealthWorker object is + * updated. + */ + public void updateHealthWorker(String oldNric, String newNric) { + for (Request request : this.internalList) { + if (Objects.equals(request.getHealthStaff(), oldNric)) { + Request editedRequest = new Request(request); + RequestStatus status = request.getRequestStatus(); + editedRequest.setHealthStaff(newNric); + editedRequest.setRequestStatus(status); + setRequest(request, editedRequest); + } + } + } + + /** + * Returns an iterator over elements of type {@code T}. + * + * @return an Iterator. + */ + @Override + public Iterator iterator() { + return internalList.iterator(); + } + + @Override + public int hashCode() { + return internalList.hashCode(); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof UniqueRequestList // instanceof handles nulls + && internalList.equals(((UniqueRequestList) other).internalList)); + } + + @Override + public String toString() { + return this.internalList.toString(); + } +} diff --git a/src/main/java/seedu/address/model/request/exceptions/DuplicateRequestException.java b/src/main/java/seedu/address/model/request/exceptions/DuplicateRequestException.java new file mode 100644 index 000000000000..4f8dae2c19e3 --- /dev/null +++ b/src/main/java/seedu/address/model/request/exceptions/DuplicateRequestException.java @@ -0,0 +1,11 @@ +package seedu.address.model.request.exceptions; + +/** + * Signals that the operation will result in duplicate Request (Requests are considered duplicates if they have the + * same identity). + */ +public class DuplicateRequestException extends RuntimeException { + public DuplicateRequestException() { + super("Operation would result in duplicate requests."); + } +} diff --git a/src/main/java/seedu/address/model/request/exceptions/RequestNotFoundException.java b/src/main/java/seedu/address/model/request/exceptions/RequestNotFoundException.java new file mode 100644 index 000000000000..964acd0b9460 --- /dev/null +++ b/src/main/java/seedu/address/model/request/exceptions/RequestNotFoundException.java @@ -0,0 +1,8 @@ +package seedu.address.model.request.exceptions; + +/** + * Signals that the operation is unable to find the specified request. + * + * @@author daviddl9 + */ +public class RequestNotFoundException extends RuntimeException {} diff --git a/src/main/java/seedu/address/model/tag/Condition.java b/src/main/java/seedu/address/model/tag/Condition.java new file mode 100644 index 000000000000..5dacca875521 --- /dev/null +++ b/src/main/java/seedu/address/model/tag/Condition.java @@ -0,0 +1,59 @@ +package seedu.address.model.tag; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +/** + * Represents a Condition in the request book. + * Guarantees: immutable; name is valid as declared in {@link #isValidConditionName(String)} + */ +public class Condition { + + public static final String MESSAGE_CONSTRAINTS = "Condition descriptions should be alphanumeric characters/spaces"; + + /** + * The first character of the condition must not be a whitespace, + * otherwise " " (a blank string) becomes a valid input. + */ + public static final String VALIDATION_CONDITION_REGEX = "[\\p{Alnum}][\\p{Alnum} ]*"; + + private final String conditionName; + + /** + * Constructs a {@code Condition}. + * + * @param conditionName A valid Condition name. + */ + public Condition(String conditionName) { + requireNonNull(conditionName); + checkArgument(isValidConditionName(conditionName), MESSAGE_CONSTRAINTS); + this.conditionName = conditionName; + } + + /** + * Returns true if a given string is a valid Condition name. + */ + public static boolean isValidConditionName(String test) { + return test.matches(VALIDATION_CONDITION_REGEX); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof Condition // instanceof handles nulls + && conditionName.equals(((Condition) other).conditionName)); // state check + } + + @Override + public int hashCode() { + return conditionName.hashCode(); + } + + /** + * Format state as text for viewing. + */ + public String toString() { + return conditionName; + } + +} diff --git a/src/main/java/seedu/address/model/tag/Skills.java b/src/main/java/seedu/address/model/tag/Skills.java new file mode 100644 index 000000000000..49db006ef20e --- /dev/null +++ b/src/main/java/seedu/address/model/tag/Skills.java @@ -0,0 +1,101 @@ +package seedu.address.model.tag; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +/** + * Class that represents a set of skills of a HealthWorker object. + */ +public class Skills { + + private Set skills; + + public Skills() { + this.skills = new HashSet<>(); + } + + /** + * Constructs a Skills object from existing {@code skills} + * + * @param skills Skills object to construct from + */ + public Skills(Skills skills) { + this.skills = new HashSet<>(skills.getSkills()); + } + + /** + * Constructs a Skills object from existing {@code skills} Set of + * Specialisations. + * @param skills Set object containing Specialisation to construct from. + */ + public Skills(Collection skills) { + this.skills = new HashSet<>(skills); + } + + public Set getSkills() { + return this.skills; + } + + /** + * Checks if a given Specialisation is in the current skills set. + * @param specialisation specialisation to check for. + * @return true if Specialisation is in the set, false otherwise + */ + public boolean contains(Specialisation specialisation) { + return this.skills.contains(specialisation); + } + + /** + * Checks if a given Specialisation is in the current skills set by first + * converting the string to Specialisation object. + * @param specialisation string to check for. + * @return true if Specialisation Enum of the string specialisation is in + * the set, false otherwise + */ + public boolean contains(String specialisation) { + if (!Specialisation.isValidSpecialisation(specialisation)) { + return false; + } + + Specialisation specialisationEnum = Specialisation + .parseString(specialisation); + + return this.skills.contains(specialisationEnum); + } + + public void addSpecialisation(Specialisation specialisation) { + this.skills.add(specialisation); + } + + /** + * Check if another set of skills is a subset of the current set of skills + */ + public boolean containsAll(Collection other) { + return this.skills.containsAll(other); + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder(); + for (Specialisation specialisation : this.skills) { + stringBuilder.append(specialisation.name()); + stringBuilder.append(" "); + } + + return stringBuilder.toString(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (!(other instanceof Skills)) { + return false; + } + + return this.skills.equals(((Skills) other).getSkills()); + } +} diff --git a/src/main/java/seedu/address/model/tag/Specialisation.java b/src/main/java/seedu/address/model/tag/Specialisation.java new file mode 100644 index 000000000000..ae7e2f05eafa --- /dev/null +++ b/src/main/java/seedu/address/model/tag/Specialisation.java @@ -0,0 +1,97 @@ +package seedu.address.model.tag; + +import java.util.Optional; + +/** + * Class that represents a specialisation for a HealthWorker object. + */ +public enum Specialisation { + + GENERAL_PRACTICE, + CARDIOLOGY, + ENDOCRINOLOGY, + NEUROLOGY, + ORTHOPAEDIC, + PAEDIATRIC, + GYNAECOLOGY, + UROLOGY, + PATHOLOGY, + HAEMATOLOGY, + PHYSIOTHERAPY, + OCCUPATIONAL_THERAPY, + ANAESTHESIOLOGY; + + public static final String MESSAGE_CONSTRAINTS = getMessageConstraints(); + + /** + * Displays a list of available specialisations. + * @return String describing all available specialisations. + */ + public static String getSpecialisationList() { + StringBuilder stringBuilder = new StringBuilder(); + for (Specialisation specialisation : Specialisation.values()) { + stringBuilder.append(specialisation.toString()).append("\n"); + } + + return stringBuilder.toString(); + } + + /** + * Checks if a given input string matches any of the available + * Specialisations + * @param input string to check for valid Specialisation. + * @return true if the input string has a matching Specialisation, else + * false. + */ + public static boolean isValidSpecialisation(String input) { + try { + Specialisation.valueOf(input); + } catch (IllegalArgumentException | NullPointerException e) { + return false; + } + + return true; + } + + /** + * Returns the corresponding matching Specialisation given an input String + * @param input string to match Specialisations. + * @return Specialisation matching the given string. + */ + public static Specialisation parseString(String input) { + return Specialisation.valueOf(input); + } + + /** + * Returns an Optional containing the matching Specialisation to the substring if any, else an empty Optional + * @param input the substring to match against the Specialisation names + * @return Optional containing the matching Specialisation, else an empty Optional + */ + public static Optional getSpecialisation (String input) { + if (input.isEmpty()) { + return Optional.empty(); + } + + for (Specialisation specialisation : Specialisation.values()) { + if (specialisation.name().toLowerCase().contains(input.toLowerCase())) { + return Optional.of(specialisation); + } + } + + return Optional.empty(); + } + + /** + * Formulates the String representing the valid specialisations and + * constraints. + * @return String containing the valid specialisations to be added. + */ + private static String getMessageConstraints() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("Valid specialisations: \n"); + stringBuilder.append(getSpecialisationList()); + + return stringBuilder.toString(); + } + +} diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/seedu/address/model/tag/Tag.java deleted file mode 100644 index b0ea7e7dad7f..000000000000 --- a/src/main/java/seedu/address/model/tag/Tag.java +++ /dev/null @@ -1,54 +0,0 @@ -package seedu.address.model.tag; - -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.AppUtil.checkArgument; - -/** - * Represents a Tag in the address book. - * Guarantees: immutable; name is valid as declared in {@link #isValidTagName(String)} - */ -public class Tag { - - public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric"; - public static final String VALIDATION_REGEX = "\\p{Alnum}+"; - - public final String tagName; - - /** - * Constructs a {@code Tag}. - * - * @param tagName A valid tag name. - */ - public Tag(String tagName) { - requireNonNull(tagName); - checkArgument(isValidTagName(tagName), MESSAGE_CONSTRAINTS); - this.tagName = tagName; - } - - /** - * Returns true if a given string is a valid tag name. - */ - public static boolean isValidTagName(String test) { - return test.matches(VALIDATION_REGEX); - } - - @Override - public boolean equals(Object other) { - return other == this // short circuit if same object - || (other instanceof Tag // instanceof handles nulls - && tagName.equals(((Tag) other).tagName)); // state check - } - - @Override - public int hashCode() { - return tagName.hashCode(); - } - - /** - * Format state as text for viewing. - */ - public String toString() { - return '[' + tagName + ']'; - } - -} diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 1806da4facfa..e45b4a6a41d1 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -1,60 +1,247 @@ package seedu.address.model.util; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; -import seedu.address.model.AddressBook; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.HealthWorkerBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; +import seedu.address.model.RequestBook; import seedu.address.model.person.Address; -import seedu.address.model.person.Email; import seedu.address.model.person.Name; -import seedu.address.model.person.Person; +import seedu.address.model.person.Nric; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.Organization; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestDate; +import seedu.address.model.request.RequestStatus; +import seedu.address.model.tag.Condition; +import seedu.address.model.tag.Skills; +import seedu.address.model.tag.Specialisation; /** - * Contains utility methods for populating {@code AddressBook} with sample data. + * Contains utility methods for populating {@code RequestBook} and {@code HealthWorkerBook} new sample data. */ public class SampleDataUtil { - public static Person[] getSamplePersons() { - return new Person[] { - new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), - getTagSet("friends")), - new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), - getTagSet("colleagues", "friends")), - new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), - getTagSet("neighbours")), - new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), - getTagSet("family")), - new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), - getTagSet("classmates")), - new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), - getTagSet("colleagues")) + + public static final HealthWorker ANDY = new HealthWorker( + new Name("Andy Tan"), + new Nric("S8312942G"), + new Phone("94358253"), + new Organization("NUH"), + new Skills(new HashSet<>(Arrays.asList(Specialisation.PHYSIOTHERAPY, + Specialisation.GENERAL_PRACTICE)))); + + public static final HealthWorker BETTY = new HealthWorker( + new Name("Betty Meier"), + new Nric("S8176952L"), + new Phone("98761232"), + new Organization("CGH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation + .GENERAL_PRACTICE, Specialisation.ORTHOPAEDIC))))); + + public static final HealthWorker CARLIE = new HealthWorker( + new Name("Carlie Kurz"), + new Nric("S9312942G"), + new Phone("95358463"), + new Organization("NUH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation.GYNAECOLOGY, + Specialisation.GENERAL_PRACTICE))))); + + public static final HealthWorker PANIEL = new HealthWorker( + new Name("Paniel Meier"), + new Nric("S9701568T"), + new Phone("87652133"), + new Organization("SGH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation.PHYSIOTHERAPY, + Specialisation.HAEMATOLOGY))))); + + public static final HealthWorker ELLA = new HealthWorker( + new Name("Ella Meyer"), + new Nric("S9112942G"), + new Phone("94824524"), + new Organization("SGH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation.ANAESTHESIOLOGY, + Specialisation.PHYSIOTHERAPY))))); + + public static final HealthWorker FIONE = new HealthWorker( + new Name("Fione Kunz"), + new Nric("S7812942G"), + new Phone("94822373"), + new Organization("TTSH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation.CARDIOLOGY, + Specialisation.OCCUPATIONAL_THERAPY))))); + + public static final HealthWorker GEORGE = new HealthWorker( + new Name("George Best"), + new Nric("S8812942G"), + new Phone("94824424"), + new Organization("TTSH"), + new Skills(new Skills(new HashSet<>(Arrays.asList(Specialisation.UROLOGY, + Specialisation.PAEDIATRIC))))); + + public static final Request ALICE_REQUEST = new Request( + new Name("Alice Pauline"), + new Nric("S9670515H"), + new Phone("94351253"), + new Address("123, Jurong West Ave 6, #08-111"), + new RequestDate("01-01-2019 10:00:00"), + getConditionSet("Physiotherapy"), + new RequestStatus("ONGOING"), + ANDY.getNric().toString() + ); + + public static final Request BENSON_REQUEST = new Request( + new Name("Benson Meier"), + new Nric("S9274100D"), + new Phone("98765432"), + new Address("311, Clementi Ave 2, #02-25"), + new RequestDate("02-01-2019 08:00:00"), + getConditionSet("Palliative"), + new RequestStatus("ONGOING"), + BETTY.getNric().toString()); + + public static final Request CARL_REQUEST = new Request( + new Name("Carl Kurz"), + new Nric("S9328723A"), + new Phone("87652533"), + new Address("wall street"), + new RequestDate("04-01-2019 14:00:00"), + getConditionSet("Palliative"), + new RequestStatus("ONGOING"), + CARLIE.getNric().toString()); + + public static final Request DANIEL_REQUEST = new Request( + new Name("Daniel Meier"), + new Nric("S2652663Z"), + new Phone("82015737"), + new Address("10th street"), + new RequestDate("02-01-2019 18:00:00"), + getConditionSet("Palliative"), + new RequestStatus("COMPLETED"), + PANIEL.getNric().toString()); + + public static final Request EMMANUEL_REQUEST = new Request( + new Name("Emmanuel Meier"), + new Nric("S2862663Z"), + new Phone("82205737"), + new Address("10th street"), + new RequestDate("02-01-2019 18:00:00"), + getConditionSet("Palliative"), + new RequestStatus("PENDING")); + + public static final Request FRANCIS_REQUEST = new Request( + new Name("Francis Meier"), + new Nric("S2122663Z"), + new Phone("82655737"), + new Address("10th street"), + new RequestDate("02-01-2019 18:00:00"), + getConditionSet("Palliative"), + new RequestStatus("PENDING")); + + public static final Request GLADYS_REQUEST = new Request( + new Name("Gladys Meier"), + new Nric("S2176663Z"), + new Phone("82659337"), + new Address("10th street"), + new RequestDate("02-01-2019 19:00:00"), + getConditionSet("Palliative"), + new RequestStatus("PENDING")); + + public static final Request HEPZHI_REQUEST = new Request( + new Name("Hepzhi Meier"), + new Nric("S2176698Z"), + new Phone("82658937"), + new Address("10th street"), + new RequestDate("02-01-2019 16:00:00"), + getConditionSet("Palliative"), + new RequestStatus("PENDING")); + + public static final Request INDIANA_REQUEST = new Request( + new Name("Indiana Meier"), + new Nric("S2184698Z"), + new Phone("82692937"), + new Address("10th street"), + new RequestDate("01-01-2019 08:00:00"), + getConditionSet("Palliative"), + new RequestStatus("PENDING")); + + public static final Request JANE_REQUEST = new Request( + new Name("Jane Romero"), + new Nric("S2652663Z"), + new Phone("82845737"), + new Address("10th street"), + new RequestDate("02-01-2019 15:00:00"), + getConditionSet("Palliative"), + new RequestStatus("COMPLETED"), + ELLA.getNric().toString()); + + public static final Request NEA_REQUEST = new Request( + new Name("Nea Karlsson"), + new Nric("S8875613T"), + new Phone("88179352"), + new Address("480 Lorong 6 Toa Payoh"), + new RequestDate("25-03-2019 10:00:00"), + getConditionSet("Physiotherapy"), + new RequestStatus("ONGOING"), + ELLA.getNric().toString()); + + private static final String VALID_NRIC = "S8312942G"; + + public static HealthWorker[] getSampleHealthWorkers() { + return new HealthWorker[] { + ANDY, BETTY, CARLIE, PANIEL, ELLA, FIONE, GEORGE }; } - public static ReadOnlyAddressBook getSampleAddressBook() { - AddressBook sampleAb = new AddressBook(); - for (Person samplePerson : getSamplePersons()) { - sampleAb.addPerson(samplePerson); + public static ReadOnlyHealthWorkerBook getSampleHealthWorkerBook() { + HealthWorkerBook sampleHwb = new HealthWorkerBook(); + for (HealthWorker sampleHealthworker : getSampleHealthWorkers()) { + sampleHwb.addHealthWorker(sampleHealthworker); } - return sampleAb; + return sampleHwb; + } + public static Request[] getSampleRequests() { + return new Request[] { + ALICE_REQUEST, BENSON_REQUEST, CARL_REQUEST, DANIEL_REQUEST, EMMANUEL_REQUEST, + FRANCIS_REQUEST, GLADYS_REQUEST, HEPZHI_REQUEST, INDIANA_REQUEST, JANE_REQUEST + + }; + } + + public static ReadOnlyRequestBook getSampleRequestBook() { + RequestBook sampleRb = new RequestBook(); + for (Request sampleRequest : getSampleRequests()) { + sampleRb.addRequest(sampleRequest); + } + return sampleRb; } /** - * Returns a tag set containing the list of strings given. + * Returns a Condition set containing the list of strings given. + * @param strings the conditions in String form. + * @return A set of conditions made from the strings. */ - public static Set getTagSet(String... strings) { + public static Set getConditionSet(String... strings) { return Arrays.stream(strings) - .map(Tag::new) + .map(Condition::new) .collect(Collectors.toSet()); } + + /** + * Returns a Specialisation from a set of strings + * @param + * @return + */ + public static Skills getSkillsFromString(String... strings) { + HashSet specialisations = new HashSet<>(); + for (String string: strings) { + specialisations.add(Specialisation.parseString(string)); + } + return new Skills(specialisations); + } } diff --git a/src/main/java/seedu/address/storage/AddressBookStorage.java b/src/main/java/seedu/address/storage/AddressBookStorage.java deleted file mode 100644 index 4599182b3f92..000000000000 --- a/src/main/java/seedu/address/storage/AddressBookStorage.java +++ /dev/null @@ -1,45 +0,0 @@ -package seedu.address.storage; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.Optional; - -import seedu.address.commons.exceptions.DataConversionException; -import seedu.address.model.ReadOnlyAddressBook; - -/** - * Represents a storage for {@link seedu.address.model.AddressBook}. - */ -public interface AddressBookStorage { - - /** - * Returns the file path of the data file. - */ - Path getAddressBookFilePath(); - - /** - * Returns AddressBook data as a {@link ReadOnlyAddressBook}. - * Returns {@code Optional.empty()} if storage file is not found. - * @throws DataConversionException if the data in storage is not in the expected format. - * @throws IOException if there was any problem when reading from the storage. - */ - Optional readAddressBook() throws DataConversionException, IOException; - - /** - * @see #getAddressBookFilePath() - */ - Optional readAddressBook(Path filePath) throws DataConversionException, IOException; - - /** - * Saves the given {@link ReadOnlyAddressBook} to the storage. - * @param addressBook cannot be null. - * @throws IOException if there was any problem writing to the file. - */ - void saveAddressBook(ReadOnlyAddressBook addressBook) throws IOException; - - /** - * @see #saveAddressBook(ReadOnlyAddressBook) - */ - void saveAddressBook(ReadOnlyAddressBook addressBook, Path filePath) throws IOException; - -} diff --git a/src/main/java/seedu/address/storage/HealthWorkerBookStorage.java b/src/main/java/seedu/address/storage/HealthWorkerBookStorage.java new file mode 100644 index 000000000000..cd8730e6f7a1 --- /dev/null +++ b/src/main/java/seedu/address/storage/HealthWorkerBookStorage.java @@ -0,0 +1,45 @@ +package seedu.address.storage; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Optional; + +import seedu.address.commons.exceptions.DataConversionException; +import seedu.address.model.ReadOnlyHealthWorkerBook; + +/** + * Represents a storage for {@link seedu.address.model.HealthWorkerBook}. + */ +public interface HealthWorkerBookStorage { + + /** + * Returns the file path of the data file. + */ + Path getHealthWorkerBookFilePath(); + + /** + * Returns HealthWorkerBook data as a {@link ReadOnlyHealthWorkerBook}. + * Returns {@code Optional.empty()} if storage file is not found. + * @throws DataConversionException if the data in storage is not in the expected format. + * @throws IOException if there was any problem when reading from the storage. + */ + Optional readHealthWorkerBook() throws DataConversionException, IOException; + + /** + * @see #getHealthWorkerBookFilePath() + */ + Optional readHealthWorkerBook(Path filePath) throws DataConversionException, IOException; + + /** + * Saves the given {@link ReadOnlyHealthWorkerBook} to the storage. + * @param healthWorkerBook cannot be null. + * @throws IOException if there was any problem writing to the file. + */ + void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook) throws IOException; + + /** + * @see #saveHealthWorkerBook(ReadOnlyHealthWorkerBook) + */ + void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook, Path filePath) throws IOException; + +} diff --git a/src/main/java/seedu/address/storage/JsonAdaptedCondition.java b/src/main/java/seedu/address/storage/JsonAdaptedCondition.java new file mode 100644 index 000000000000..7ed900ee971a --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonAdaptedCondition.java @@ -0,0 +1,48 @@ +package seedu.address.storage; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.model.tag.Condition; + +/** + * Jackson-friendly version of {@link Condition}. + */ +class JsonAdaptedCondition { + + private final String conditionName; + + /** + * Constructs a {@code JsonAdaptedCondition} with the given {@code conditionName}. + */ + @JsonCreator + public JsonAdaptedCondition(String conditionName) { + this.conditionName = conditionName; + } + + /** + * Converts a given {@code Condition} into this class for Jackson use. + */ + public JsonAdaptedCondition(Condition source) { + conditionName = source.toString(); + } + + @JsonValue + public String getConditionName() { + return conditionName; + } + + /** + * Converts this Jackson-friendly adapted tag object into the model's {@code Condition} object. + * + * @throws IllegalValueException if there were any data constraints violated in the adapted condition. + */ + public Condition toModelType() throws IllegalValueException { + if (!Condition.isValidConditionName(conditionName)) { + throw new IllegalValueException(Condition.MESSAGE_CONSTRAINTS); + } + return new Condition(conditionName); + } + +} diff --git a/src/main/java/seedu/address/storage/JsonAdaptedHealthWorker.java b/src/main/java/seedu/address/storage/JsonAdaptedHealthWorker.java new file mode 100644 index 000000000000..96306efea662 --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonAdaptedHealthWorker.java @@ -0,0 +1,111 @@ +package seedu.address.storage; + +import java.util.HashSet; +import java.util.Set; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Phone; +import seedu.address.model.person.healthworker.HealthWorker; +import seedu.address.model.person.healthworker.Organization; +import seedu.address.model.tag.Skills; +import seedu.address.model.tag.Specialisation; + +/** + * Jackson-friendly version of {@link HealthWorker}. + */ +class JsonAdaptedHealthWorker extends JsonAdaptedPerson { + + public static final String MISSING_FIELD_MESSAGE_FORMAT = "Person's %s field is missing!"; + + private final String organization; + private final String skills; + + /** + * Constructs a {@code JsonAdaptedHealthWorker} with the given person details. + */ + @JsonCreator + public JsonAdaptedHealthWorker(@JsonProperty("name") String name, + @JsonProperty("phone") String phone, + @JsonProperty("nric") String nric, + @JsonProperty("organization") String organisation, + @JsonProperty("skills") String skills) { + super(name, phone, nric); + this.organization = organisation; + this.skills = skills; + } + + /** + * Converts a given {@code HealthWorker} into this class for Jackson use. + */ + public JsonAdaptedHealthWorker(HealthWorker source) { + super(source); + this.organization = source.getOrganization().getOrgName(); + this.skills = source.getSkills().toString(); + } + + /** + * Converts this Jackson-friendly adapted person object into the model's {@code HealthWorker} object. + * + * @throws IllegalValueException if there were any data constraints violated in the adapted HealthWorker. + */ + @Override + public HealthWorker toModelType() throws IllegalValueException { + + if (name == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName())); + } + if (!Name.isValidName(name)) { + throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS); + } + final Name modelName = new Name(name); + + if (phone == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Phone.class.getSimpleName())); + } + if (!Phone.isValidPhone(phone)) { + throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS); + } + final Phone modelPhone = new Phone(phone); + + if (nric == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Nric.class.getSimpleName())); + } + if (!Nric.isValidNric(nric)) { + throw new IllegalValueException(Nric.MESSAGE_CONSTRAINTS); + } + final Nric modelNric = new Nric(nric); + + if (organization == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + Organization.class.getSimpleName())); + } + + if (!Organization.isValidOrgName(organization)) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + Organization.class.getSimpleName())); + } + + final Organization modelOrganisation = new Organization(organization); + + if (skills == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Skills.class.getSimpleName())); + } + + Set set = new HashSet<>(); + String[] skillsArr = this.skills.split(" "); + for (String skill : skillsArr) { + Specialisation spec = Specialisation.parseString(skill); + set.add(spec); + } + final Skills modelSkills = new Skills(set); + + return new HealthWorker(modelName, modelNric, modelPhone, modelOrganisation, modelSkills); + + } + +} diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index a6321cec2eac..14f5ec2fd929 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -1,21 +1,14 @@ package seedu.address.storage; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.model.person.Address; -import seedu.address.model.person.Email; import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; -import seedu.address.model.tag.Tag; /** * Jackson-friendly version of {@link Person}. @@ -24,39 +17,29 @@ class JsonAdaptedPerson { public static final String MISSING_FIELD_MESSAGE_FORMAT = "Person's %s field is missing!"; - private final String name; - private final String phone; - private final String email; - private final String address; - private final List tagged = new ArrayList<>(); + protected final String name; + protected final String phone; + protected final String nric; /** * Constructs a {@code JsonAdaptedPerson} with the given person details. */ @JsonCreator - public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, - @JsonProperty("tagged") List tagged) { + public JsonAdaptedPerson(@JsonProperty("name") String name, + @JsonProperty("phone") String phone, + @JsonProperty("nric") String nric) { this.name = name; this.phone = phone; - this.email = email; - this.address = address; - if (tagged != null) { - this.tagged.addAll(tagged); - } + this.nric = nric; } /** * Converts a given {@code Person} into this class for Jackson use. */ public JsonAdaptedPerson(Person source) { - name = source.getName().fullName; + name = source.getName().toString(); phone = source.getPhone().value; - email = source.getEmail().value; - address = source.getAddress().value; - tagged.addAll(source.getTags().stream() - .map(JsonAdaptedTag::new) - .collect(Collectors.toList())); + nric = source.getNric().toString(); } /** @@ -65,10 +48,6 @@ public JsonAdaptedPerson(Person source) { * @throws IllegalValueException if there were any data constraints violated in the adapted person. */ public Person toModelType() throws IllegalValueException { - final List personTags = new ArrayList<>(); - for (JsonAdaptedTag tag : tagged) { - personTags.add(tag.toModelType()); - } if (name == null) { throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName())); @@ -86,24 +65,15 @@ public Person toModelType() throws IllegalValueException { } final Phone modelPhone = new Phone(phone); - if (email == null) { - throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Email.class.getSimpleName())); - } - if (!Email.isValidEmail(email)) { - throw new IllegalValueException(Email.MESSAGE_CONSTRAINTS); - } - final Email modelEmail = new Email(email); - - if (address == null) { - throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Address.class.getSimpleName())); + if (nric == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Nric.class.getSimpleName())); } - if (!Address.isValidAddress(address)) { + if (!Nric.isValidNric(nric)) { throw new IllegalValueException(Address.MESSAGE_CONSTRAINTS); } - final Address modelAddress = new Address(address); + final Nric modelNric = new Nric(nric); - final Set modelTags = new HashSet<>(personTags); - return new Person(modelName, modelPhone, modelEmail, modelAddress, modelTags); + return new Person(modelName, modelNric, modelPhone); } } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedRequest.java b/src/main/java/seedu/address/storage/JsonAdaptedRequest.java new file mode 100644 index 000000000000..8122eae836d3 --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonAdaptedRequest.java @@ -0,0 +1,168 @@ +package seedu.address.storage; + +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.commons.util.JsonUtil; +import seedu.address.model.person.Address; +import seedu.address.model.person.Name; +import seedu.address.model.person.Nric; +import seedu.address.model.person.Phone; +import seedu.address.model.request.Request; +import seedu.address.model.request.RequestDate; +import seedu.address.model.request.RequestStatus; +import seedu.address.model.tag.Condition; + + +/** + * Jackson-friendly version of {@link Request}. + */ +class JsonAdaptedRequest { + + public static final String MISSING_FIELD_MESSAGE_FORMAT = "Request's %s field is missing!"; + + private final String name; + private final String nric; + private final String address; + private final String phone; + private final String requestDate; + private final String conditions; + private final String requestStatus; + private String healthWorker; + + /** + * Constructs a {@code JsonAdaptedPerson} with the given person details. + */ + @JsonCreator + public JsonAdaptedRequest(@JsonProperty("name") String name, + @JsonProperty("nric") String nric, + @JsonProperty("phone") String phone, + @JsonProperty("address") String address, + @JsonProperty("requestDate") String requestDate, + @JsonProperty("conditions") String conditions, + @JsonProperty("requestStatus") String requestStatus, + @JsonProperty("healthWorker") String healthWorker) { + this.name = name; + this.nric = nric; + this.address = address; + this.phone = phone; + this.requestDate = requestDate; + this.conditions = conditions; + this.requestStatus = requestStatus; + this.healthWorker = healthWorker; + } + + /** + * Converts a given {@code Request} into this class for Jackson use. + */ + public JsonAdaptedRequest(Request source) { + this.name = source.getName().toString(); + this.address = source.getAddress().value; + this.nric = source.getNric().toString(); + this.phone = source.getPhone().value; + this.requestDate = source.getRequestDate().toString(); + this.requestStatus = source.getRequestStatus().toString(); + this.conditions = source.getConditions().stream().map(Condition::toString) + .collect(Collectors.joining(" ")); + System.out.println(this.conditions); + this.healthWorker = source.getHealthStaff(); + } + + /** + * Converts this Jackson-friendly adapted person object into the model's {@code Request} object. + * + * @throws IllegalValueException if there were any data constraints violated in the adapted person. + */ + public Request toModelType() throws IllegalValueException { + + if (name == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + Name.class.getSimpleName())); + } + + if (!Name.isValidName(name)) { + throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS); + } + + final Name modelName = new Name(name); + + if (phone == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Phone.class.getSimpleName())); + } + if (!Phone.isValidPhone(phone)) { + throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS); + } + final Phone modelPhone = new Phone(phone); + + if (address == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Address.class.getSimpleName())); + } + if (!Address.isValidAddress(address)) { + throw new IllegalValueException(Address.MESSAGE_CONSTRAINTS); + } + final Address modelAddress = new Address(address); + + if (nric == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Nric.class.getSimpleName())); + } + if (!Nric.isValidNric(nric)) { + throw new IllegalValueException(Nric.MESSAGE_CONSTRAINTS); + } + final Nric modelNric = new Nric(nric); + + if (requestDate == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + RequestDate.class.getSimpleName())); + } + + if (!RequestDate.isValidDate(requestDate)) { + throw new IllegalValueException(RequestDate.MESSAGE_CONSTRAINTS); + } + + final RequestDate modelrequestDate = new RequestDate(this.requestDate); + + if (requestStatus == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, + RequestStatus.class.getSimpleName())); + } + + if (!RequestStatus.isValidStatus(requestStatus)) { + throw new IllegalValueException(RequestStatus.MESSAGE_STATUS_CONSTRAINTS); + } + + final RequestStatus modelrequestStatus = new RequestStatus(this.requestStatus); + + Set modelConditions = new HashSet<>(); + String[] conditionsArr = this.conditions.split(" "); + for (String condition : conditionsArr) { + Condition conditionToAdd = new Condition(condition); + modelConditions.add(conditionToAdd); + } + + + if (healthWorker == null) { + return new Request(modelName, modelNric, modelPhone, modelAddress, modelrequestDate, + modelConditions, modelrequestStatus); + } + return new Request(modelName, modelNric, modelPhone, modelAddress, modelrequestDate, + modelConditions, modelrequestStatus, healthWorker); + } + + @Override + public String toString() { + String message = "Unable to parse"; + try { + message = JsonUtil.toJsonString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return message; + } + +} diff --git a/src/main/java/seedu/address/storage/JsonAdaptedTag.java b/src/main/java/seedu/address/storage/JsonAdaptedTag.java deleted file mode 100644 index 0df22bdb7546..000000000000 --- a/src/main/java/seedu/address/storage/JsonAdaptedTag.java +++ /dev/null @@ -1,48 +0,0 @@ -package seedu.address.storage; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.tag.Tag; - -/** - * Jackson-friendly version of {@link Tag}. - */ -class JsonAdaptedTag { - - private final String tagName; - - /** - * Constructs a {@code JsonAdaptedTag} with the given {@code tagName}. - */ - @JsonCreator - public JsonAdaptedTag(String tagName) { - this.tagName = tagName; - } - - /** - * Converts a given {@code Tag} into this class for Jackson use. - */ - public JsonAdaptedTag(Tag source) { - tagName = source.tagName; - } - - @JsonValue - public String getTagName() { - return tagName; - } - - /** - * Converts this Jackson-friendly adapted tag object into the model's {@code Tag} object. - * - * @throws IllegalValueException if there were any data constraints violated in the adapted tag. - */ - public Tag toModelType() throws IllegalValueException { - if (!Tag.isValidTagName(tagName)) { - throw new IllegalValueException(Tag.MESSAGE_CONSTRAINTS); - } - return new Tag(tagName); - } - -} diff --git a/src/main/java/seedu/address/storage/JsonHealthWorkerBookStorage.java b/src/main/java/seedu/address/storage/JsonHealthWorkerBookStorage.java new file mode 100644 index 000000000000..63509630b146 --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonHealthWorkerBookStorage.java @@ -0,0 +1,81 @@ +package seedu.address.storage; + +import static java.util.Objects.requireNonNull; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Optional; +import java.util.logging.Logger; + +import seedu.address.commons.core.LogsCenter; +import seedu.address.commons.exceptions.DataConversionException; +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.commons.util.FileUtil; +import seedu.address.commons.util.JsonUtil; +import seedu.address.model.ReadOnlyHealthWorkerBook; + + +/** + * A class to access HealthWorkerBook data stored as a json file on the hard disk. + */ +public class JsonHealthWorkerBookStorage implements HealthWorkerBookStorage { + + private static final Logger logger = LogsCenter.getLogger(JsonHealthWorkerBookStorage.class); + + private Path filePath; + + public JsonHealthWorkerBookStorage(Path filePath) { + this.filePath = filePath; + } + + public Path getHealthWorkerBookFilePath() { + return filePath; + } + + @Override + public Optional readHealthWorkerBook() throws DataConversionException { + return readHealthWorkerBook(filePath); + } + + /** + * Similar to {@link #readHealthWorkerBook()}. + * + * @param filePath location of the data. Cannot be null. + * @throws DataConversionException if the file is not in the correct format. + */ + public Optional readHealthWorkerBook(Path filePath) throws DataConversionException { + requireNonNull(filePath); + + Optional jsonHealthWorkerBook = JsonUtil.readJsonFile( + filePath, JsonSerializableHealthWorkerBook.class); + if (!jsonHealthWorkerBook.isPresent()) { + return Optional.empty(); + } + + try { + return Optional.of(jsonHealthWorkerBook.get().toModelType()); + } catch (IllegalValueException ive) { + logger.info("Illegal values found in " + filePath + ": " + ive.getMessage()); + throw new DataConversionException(ive); + } + } + + @Override + public void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook) throws IOException { + saveHealthWorkerBook(healthWorkerBook, filePath); + } + + /** + * Similar to {@link #saveHealthWorkerBook(ReadOnlyHealthWorkerBook)}. + * + * @param filePath location of the data. Cannot be null. + */ + public void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook, Path filePath) throws IOException { + requireNonNull(healthWorkerBook); + requireNonNull(filePath); + + FileUtil.createIfMissing(filePath); + JsonUtil.saveJsonFile(new JsonSerializableHealthWorkerBook(healthWorkerBook), filePath); + } + +} diff --git a/src/main/java/seedu/address/storage/JsonAddressBookStorage.java b/src/main/java/seedu/address/storage/JsonRequestBookStorage.java similarity index 55% rename from src/main/java/seedu/address/storage/JsonAddressBookStorage.java rename to src/main/java/seedu/address/storage/JsonRequestBookStorage.java index dfab9daaa0d3..1828353da2d4 100644 --- a/src/main/java/seedu/address/storage/JsonAddressBookStorage.java +++ b/src/main/java/seedu/address/storage/JsonRequestBookStorage.java @@ -12,47 +12,51 @@ import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.commons.util.FileUtil; import seedu.address.commons.util.JsonUtil; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.ReadOnlyRequestBook; /** - * A class to access AddressBook data stored as a json file on the hard disk. + * A class to access RequestBook data stored as a json file on the hard disk. */ -public class JsonAddressBookStorage implements AddressBookStorage { +public class JsonRequestBookStorage implements RequestBookStorage { - private static final Logger logger = LogsCenter.getLogger(JsonAddressBookStorage.class); + private static final Logger logger = LogsCenter.getLogger(JsonRequestBookStorage.class); private Path filePath; - public JsonAddressBookStorage(Path filePath) { + public JsonRequestBookStorage(Path filePath) { this.filePath = filePath; } - public Path getAddressBookFilePath() { + /** + * Returns the file path of the data file. + */ + @Override + public Path getRequestBookFilePath() { return filePath; } @Override - public Optional readAddressBook() throws DataConversionException { - return readAddressBook(filePath); + public Optional readRequestBook() throws DataConversionException { + return readRequestBook(filePath); } /** - * Similar to {@link #readAddressBook()}. + * Similar to {@link #readRequestBook()}. * * @param filePath location of the data. Cannot be null. * @throws DataConversionException if the file is not in the correct format. */ - public Optional readAddressBook(Path filePath) throws DataConversionException { + public Optional readRequestBook(Path filePath) throws DataConversionException { requireNonNull(filePath); - Optional jsonAddressBook = JsonUtil.readJsonFile( - filePath, JsonSerializableAddressBook.class); - if (!jsonAddressBook.isPresent()) { + Optional jsonRequestBook = JsonUtil.readJsonFile( + filePath, JsonSerializableRequestBook.class); + if (!jsonRequestBook.isPresent()) { return Optional.empty(); } try { - return Optional.of(jsonAddressBook.get().toModelType()); + return Optional.of(jsonRequestBook.get().toModelType()); } catch (IllegalValueException ive) { logger.info("Illegal values found in " + filePath + ": " + ive.getMessage()); throw new DataConversionException(ive); @@ -60,21 +64,21 @@ public Optional readAddressBook(Path filePath) throws DataC } @Override - public void saveAddressBook(ReadOnlyAddressBook addressBook) throws IOException { - saveAddressBook(addressBook, filePath); + public void saveRequestBook(ReadOnlyRequestBook requestBook) throws IOException { + saveRequestBook(requestBook, filePath); } /** - * Similar to {@link #saveAddressBook(ReadOnlyAddressBook)}. + * Similar to {@link #saveRequestBook(ReadOnlyRequestBook)}. * * @param filePath location of the data. Cannot be null. */ - public void saveAddressBook(ReadOnlyAddressBook addressBook, Path filePath) throws IOException { - requireNonNull(addressBook); + public void saveRequestBook(ReadOnlyRequestBook requestBook, Path filePath) throws IOException { + requireNonNull(requestBook); requireNonNull(filePath); FileUtil.createIfMissing(filePath); - JsonUtil.saveJsonFile(new JsonSerializableAddressBook(addressBook), filePath); + JsonUtil.saveJsonFile(new JsonSerializableRequestBook(requestBook), filePath); } } diff --git a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java b/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java deleted file mode 100644 index 5efd834091d4..000000000000 --- a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java +++ /dev/null @@ -1,60 +0,0 @@ -package seedu.address.storage; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -import seedu.address.commons.exceptions.IllegalValueException; -import seedu.address.model.AddressBook; -import seedu.address.model.ReadOnlyAddressBook; -import seedu.address.model.person.Person; - -/** - * An Immutable AddressBook that is serializable to JSON format. - */ -@JsonRootName(value = "addressbook") -class JsonSerializableAddressBook { - - public static final String MESSAGE_DUPLICATE_PERSON = "Persons list contains duplicate person(s)."; - - private final List persons = new ArrayList<>(); - - /** - * Constructs a {@code JsonSerializableAddressBook} with the given persons. - */ - @JsonCreator - public JsonSerializableAddressBook(@JsonProperty("persons") List persons) { - this.persons.addAll(persons); - } - - /** - * Converts a given {@code ReadOnlyAddressBook} into this class for Jackson use. - * - * @param source future changes to this will not affect the created {@code JsonSerializableAddressBook}. - */ - public JsonSerializableAddressBook(ReadOnlyAddressBook source) { - persons.addAll(source.getPersonList().stream().map(JsonAdaptedPerson::new).collect(Collectors.toList())); - } - - /** - * Converts this address book into the model's {@code AddressBook} object. - * - * @throws IllegalValueException if there were any data constraints violated. - */ - public AddressBook toModelType() throws IllegalValueException { - AddressBook addressBook = new AddressBook(); - for (JsonAdaptedPerson jsonAdaptedPerson : persons) { - Person person = jsonAdaptedPerson.toModelType(); - if (addressBook.hasPerson(person)) { - throw new IllegalValueException(MESSAGE_DUPLICATE_PERSON); - } - addressBook.addPerson(person); - } - return addressBook; - } - -} diff --git a/src/main/java/seedu/address/storage/JsonSerializableHealthWorkerBook.java b/src/main/java/seedu/address/storage/JsonSerializableHealthWorkerBook.java new file mode 100644 index 000000000000..62c7f3ae543d --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonSerializableHealthWorkerBook.java @@ -0,0 +1,67 @@ +package seedu.address.storage; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.model.HealthWorkerBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * An Immutable HealthWorkerBook that is serializable to JSON format. + */ +@JsonRootName(value = "healthWorkerBook") +class JsonSerializableHealthWorkerBook { + + public static final String MESSAGE_DUPLICATE_HEALTHWORKER = + "HealthWorkers list contains duplicate healthWorker(s)."; + + + private final List healthWorkers = new ArrayList<>(); + + /** + * Constructs a {@code JsonSerializableHealthWorkerBook} with the given healthWorkers. + */ + @JsonCreator + public JsonSerializableHealthWorkerBook(@JsonProperty("healthWorkers") + List healthWorkers) { + this.healthWorkers.addAll(healthWorkers); + } + + /** + * Converts a given {@code ReadOnlyHealthWorkerBook} into this class for Jackson use. + * + * @param source future changes to this will not affect the created {@code JsonSerializableHealthWorkerBook}. + */ + public JsonSerializableHealthWorkerBook(ReadOnlyHealthWorkerBook source) { + healthWorkers.addAll(source.getHealthWorkerList().stream() + .map(JsonAdaptedHealthWorker::new).collect(Collectors.toList())); + + } + + /** + * Converts this address book into the model's {@code HealthWorkerBook} object. + * + * @throws IllegalValueException if there were any data constraints violated. + */ + public HealthWorkerBook toModelType() throws IllegalValueException { + HealthWorkerBook healthWorkerBook = new HealthWorkerBook(); + for (JsonAdaptedHealthWorker jsonAdaptedHealthWorker : healthWorkers) { + HealthWorker healthWorker = jsonAdaptedHealthWorker.toModelType(); + if (healthWorkerBook.hasHealthWorker(healthWorker)) { + throw new IllegalValueException(MESSAGE_DUPLICATE_HEALTHWORKER); + } + healthWorkerBook.addHealthWorker(healthWorker); + } + return healthWorkerBook; + } + + + +} diff --git a/src/main/java/seedu/address/storage/JsonSerializableRequestBook.java b/src/main/java/seedu/address/storage/JsonSerializableRequestBook.java new file mode 100644 index 000000000000..48008c544ff7 --- /dev/null +++ b/src/main/java/seedu/address/storage/JsonSerializableRequestBook.java @@ -0,0 +1,61 @@ +package seedu.address.storage; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import seedu.address.commons.exceptions.IllegalValueException; +import seedu.address.model.ReadOnlyRequestBook; +import seedu.address.model.RequestBook; +import seedu.address.model.request.Request; + +/** + * An Immutable RequestBook that is serializable to JSON format. + */ +@JsonRootName(value = "requestbook") +public class JsonSerializableRequestBook { + + public static final String MESSAGE_DUPLICATE_REQUEST = "Request list contains duplicate " + + "request(s)."; + + private final List requests = new ArrayList<>(); + + /** + * Constructs a {@code JsonSerializableRequestBook} with the given persons. + */ + @JsonCreator + public JsonSerializableRequestBook(@JsonProperty("requests") List requests) { + this.requests.addAll(requests); + } + + /** + * Converts a given {@code ReadOnlyRequestBook} into this class for Jackson use. + * + * @param source future changes to this will not affect the created {@code JsonSerializableRequestBook}. + */ + public JsonSerializableRequestBook(ReadOnlyRequestBook source) { + requests.addAll(source.getRequestList().stream().map(JsonAdaptedRequest::new).collect(Collectors.toList())); + } + + /** + * Converts this address book into the model's {@code RequestBook} object. + * + * @throws IllegalValueException if there were any data constraints violated. + */ + public RequestBook toModelType() throws IllegalValueException { + RequestBook requestBook = new RequestBook(); + for (JsonAdaptedRequest jsonAdaptedRequest : requests) { + Request request = jsonAdaptedRequest.toModelType(); + if (requestBook.hasRequest(request)) { + throw new IllegalValueException(MESSAGE_DUPLICATE_REQUEST); + } + requestBook.addRequest(request); + } + return requestBook; + } + +} diff --git a/src/main/java/seedu/address/storage/RequestBookStorage.java b/src/main/java/seedu/address/storage/RequestBookStorage.java new file mode 100644 index 000000000000..c0b86aac3abd --- /dev/null +++ b/src/main/java/seedu/address/storage/RequestBookStorage.java @@ -0,0 +1,46 @@ +package seedu.address.storage; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Optional; + +import seedu.address.commons.exceptions.DataConversionException; +import seedu.address.model.ReadOnlyRequestBook; + +/** + * Represents a storage for {@link seedu.address.model.RequestBook}. + * + * @@author daviddl9 + */ +public interface RequestBookStorage { + + /** + * Returns the file path of the data file. + */ + Path getRequestBookFilePath(); + + /** + * Returns RequestBook data as a {@link ReadOnlyRequestBook}. + * Returns {@code Optional.empty()} if storage file is not found. + * @throws DataConversionException if the data in storage is not in the expected format. + * @throws IOException if there was any problem when reading from the storage. + */ + Optional readRequestBook() throws DataConversionException, IOException; + + /** + * @see #getRequestBookFilePath() + */ + Optional readRequestBook(Path filePath) throws DataConversionException, IOException; + + /** + * Saves the given {@link ReadOnlyRequestBook} to the storage. + * @param requestBook cannot be null. + * @throws IOException if there was any problem writing to the file. + */ + void saveRequestBook(ReadOnlyRequestBook requestBook) throws IOException; + + /** + * @see #saveRequestBook(ReadOnlyRequestBook) + */ + void saveRequestBook(ReadOnlyRequestBook readOnlyRequestBook, Path filePath) throws IOException; +} diff --git a/src/main/java/seedu/address/storage/Storage.java b/src/main/java/seedu/address/storage/Storage.java index beda8bd9f11b..732d2965a4f0 100644 --- a/src/main/java/seedu/address/storage/Storage.java +++ b/src/main/java/seedu/address/storage/Storage.java @@ -5,14 +5,16 @@ import java.util.Optional; import seedu.address.commons.exceptions.DataConversionException; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; import seedu.address.model.ReadOnlyUserPrefs; import seedu.address.model.UserPrefs; /** * API of the Storage component */ -public interface Storage extends AddressBookStorage, UserPrefsStorage { +public interface Storage extends UserPrefsStorage, + RequestBookStorage, HealthWorkerBookStorage { @Override Optional readUserPrefs() throws DataConversionException, IOException; @@ -21,12 +23,21 @@ public interface Storage extends AddressBookStorage, UserPrefsStorage { void saveUserPrefs(ReadOnlyUserPrefs userPrefs) throws IOException; @Override - Path getAddressBookFilePath(); + Path getHealthWorkerBookFilePath(); @Override - Optional readAddressBook() throws DataConversionException, IOException; + Path getRequestBookFilePath(); @Override - void saveAddressBook(ReadOnlyAddressBook addressBook) throws IOException; + Optional readRequestBook() throws DataConversionException, IOException; + + @Override + Optional readHealthWorkerBook() throws DataConversionException, IOException; + + @Override + void saveRequestBook(ReadOnlyRequestBook requestBook) throws IOException; + + @Override + void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook) throws IOException; } diff --git a/src/main/java/seedu/address/storage/StorageManager.java b/src/main/java/seedu/address/storage/StorageManager.java index e4f452b6cbf4..554b258ceacf 100644 --- a/src/main/java/seedu/address/storage/StorageManager.java +++ b/src/main/java/seedu/address/storage/StorageManager.java @@ -7,24 +7,28 @@ import seedu.address.commons.core.LogsCenter; import seedu.address.commons.exceptions.DataConversionException; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; import seedu.address.model.ReadOnlyUserPrefs; import seedu.address.model.UserPrefs; /** - * Manages storage of AddressBook data in local storage. + * Manages storage of Books data in local storage. */ public class StorageManager implements Storage { private static final Logger logger = LogsCenter.getLogger(StorageManager.class); - private AddressBookStorage addressBookStorage; private UserPrefsStorage userPrefsStorage; + private RequestBookStorage requestBookStorage; + private HealthWorkerBookStorage healthWorkerBookStorage; - public StorageManager(AddressBookStorage addressBookStorage, UserPrefsStorage userPrefsStorage) { + public StorageManager(UserPrefsStorage userPrefStorage, + RequestBookStorage requestBookStorage, HealthWorkerBookStorage healthWorkerBookStorage) { super(); - this.addressBookStorage = addressBookStorage; - this.userPrefsStorage = userPrefsStorage; + this.userPrefsStorage = userPrefStorage; + this.requestBookStorage = requestBookStorage; + this.healthWorkerBookStorage = healthWorkerBookStorage; } // ================ UserPrefs methods ============================== @@ -45,33 +49,69 @@ public void saveUserPrefs(ReadOnlyUserPrefs userPrefs) throws IOException { } - // ================ AddressBook methods ============================== + // ================ RequestBook methods ============================== + /** + * Returns the file path of the data file. + */ @Override - public Path getAddressBookFilePath() { - return addressBookStorage.getAddressBookFilePath(); + public Path getRequestBookFilePath() { + return requestBookStorage.getRequestBookFilePath(); } @Override - public Optional readAddressBook() throws DataConversionException, IOException { - return readAddressBook(addressBookStorage.getAddressBookFilePath()); + public Optional readRequestBook() throws DataConversionException, IOException { + return readRequestBook(requestBookStorage.getRequestBookFilePath()); } @Override - public Optional readAddressBook(Path filePath) throws DataConversionException, IOException { + public Optional readRequestBook(Path filePath) throws DataConversionException, IOException { logger.fine("Attempting to read data from file: " + filePath); - return addressBookStorage.readAddressBook(filePath); + return requestBookStorage.readRequestBook(filePath); } @Override - public void saveAddressBook(ReadOnlyAddressBook addressBook) throws IOException { - saveAddressBook(addressBook, addressBookStorage.getAddressBookFilePath()); + public void saveRequestBook(ReadOnlyRequestBook requestBook) throws IOException { + saveRequestBook(requestBook, requestBookStorage.getRequestBookFilePath()); } @Override - public void saveAddressBook(ReadOnlyAddressBook addressBook, Path filePath) throws IOException { + public void saveRequestBook(ReadOnlyRequestBook readOnlyRequestBook, Path filePath) throws IOException { logger.fine("Attempting to write to data file: " + filePath); - addressBookStorage.saveAddressBook(addressBook, filePath); + requestBookStorage.saveRequestBook(readOnlyRequestBook, filePath); + } + + + //================ HealthWorkerBook methods ============================== + /** + * Returns the file path of the data file. + */ + @Override + public Path getHealthWorkerBookFilePath() { + return healthWorkerBookStorage.getHealthWorkerBookFilePath(); + } + + @Override + public Optional readHealthWorkerBook() throws DataConversionException, IOException { + return readHealthWorkerBook(healthWorkerBookStorage.getHealthWorkerBookFilePath()); + } + + @Override + public Optional readHealthWorkerBook(Path filePath) + throws DataConversionException, IOException { + logger.fine("Attempting to read data from file: " + filePath); + return healthWorkerBookStorage.readHealthWorkerBook(filePath); + } + + @Override + public void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook) throws IOException { + saveHealthWorkerBook(healthWorkerBook, healthWorkerBookStorage.getHealthWorkerBookFilePath()); + } + + @Override + public void saveHealthWorkerBook(ReadOnlyHealthWorkerBook healthWorkerBook, Path filePath) throws IOException { + logger.fine("Attempting to write to data file: " + filePath); + healthWorkerBookStorage.saveHealthWorkerBook(healthWorkerBook, filePath); } } diff --git a/src/main/java/seedu/address/ui/AutoCompleteTextField.java b/src/main/java/seedu/address/ui/AutoCompleteTextField.java new file mode 100644 index 000000000000..4bc05071a910 --- /dev/null +++ b/src/main/java/seedu/address/ui/AutoCompleteTextField.java @@ -0,0 +1,104 @@ +package seedu.address.ui; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Side; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.CustomMenuItem; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; + +/** + * This is a custom UI control that inherits from the TextField class, + * with auto-complete functionality. It aims to show users the type of + * commands they can type in the command text field. + * @author Hui Chun + */ +public class AutoCompleteTextField extends TextField { + + public static final String ERROR_STYLE_CLASS = "error"; + + private final SortedSet suggestions; + + private ContextMenu autocompleteBox; + + public AutoCompleteTextField() { + super(); + suggestions = new TreeSet<>(); + autocompleteBox = new ContextMenu(); + + textProperty().addListener((observable, s1, s2) -> { + + // calls #setStyleToDefault() whenever there is a change to the text of the command box. + setStyleToDefault(); + + if (getText().length() != 0 && suggestions.size() > 0) { + Iterator iterator = suggestions.iterator(); + LinkedList searchResult = new LinkedList<>(); + while (iterator.hasNext()) { + String suggestion = iterator.next().toString(); + if (suggestion.startsWith(getText())) { + searchResult.add(suggestion); + } + } + + buildContextMenu(searchResult); + if (!autocompleteBox.isShowing()) { + autocompleteBox.show(AutoCompleteTextField.this, Side.BOTTOM, 0, 0); + } + } else { + autocompleteBox.hide(); + } + }); + + } + + /** + * Sets the command box style to use the default style. + */ + private void setStyleToDefault() { + this.getStyleClass().remove(ERROR_STYLE_CLASS); + } + + /** + * Get the existing set of autocomplete suggestions. + * @return The existing autocomplete suggestions. + */ + public SortedSet getSuggestions() { + return this.suggestions; + } + + /** + * Populate the entry set with the given search results. Display is limited to 10 entries, for performance. + * @param searchResult The set of matching strings. + */ + private void buildContextMenu(List searchResult) { + List menuItems = new LinkedList<>(); + + // Only show max 10 entries in the autocompletion box + int maxEntries = 10; + int count = Math.min(searchResult.size(), maxEntries); + for (int i = 0; i < count; i++) { + final String result = searchResult.get(i); + Label label = new Label(result); + CustomMenuItem item = new CustomMenuItem(label, true); + item.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent actionEvent) { + setText(result); + positionCaret(result.length()); + autocompleteBox.hide(); + } + }); + menuItems.add(item); + } + autocompleteBox.getItems().clear(); + autocompleteBox.getItems().addAll(menuItems); + } +} diff --git a/src/main/java/seedu/address/ui/BrowserPanel.java b/src/main/java/seedu/address/ui/BrowserPanel.java deleted file mode 100644 index 53876e01c8d1..000000000000 --- a/src/main/java/seedu/address/ui/BrowserPanel.java +++ /dev/null @@ -1,67 +0,0 @@ -package seedu.address.ui; - -import static java.util.Objects.requireNonNull; - -import java.net.URL; -import java.util.logging.Logger; - -import javafx.application.Platform; -import javafx.beans.value.ObservableValue; -import javafx.event.Event; -import javafx.fxml.FXML; -import javafx.scene.layout.Region; -import javafx.scene.web.WebView; -import seedu.address.MainApp; -import seedu.address.commons.core.LogsCenter; -import seedu.address.model.person.Person; - -/** - * The Browser Panel of the App. - */ -public class BrowserPanel extends UiPart { - - public static final URL DEFAULT_PAGE = - requireNonNull(MainApp.class.getResource(FXML_FILE_FOLDER + "default.html")); - public static final String SEARCH_PAGE_URL = "https://se-education.org/dummy-search-page/?name="; - - private static final String FXML = "BrowserPanel.fxml"; - - private final Logger logger = LogsCenter.getLogger(getClass()); - - @FXML - private WebView browser; - - public BrowserPanel(ObservableValue selectedPerson) { - super(FXML); - - // To prevent triggering events for typing inside the loaded Web page. - getRoot().setOnKeyPressed(Event::consume); - - // Load person page when selected person changes. - selectedPerson.addListener((observable, oldValue, newValue) -> { - if (newValue == null) { - loadDefaultPage(); - return; - } - loadPersonPage(newValue); - }); - - loadDefaultPage(); - } - - private void loadPersonPage(Person person) { - loadPage(SEARCH_PAGE_URL + person.getName().fullName); - } - - public void loadPage(String url) { - Platform.runLater(() -> browser.getEngine().load(url)); - } - - /** - * Loads a default HTML file with a background that matches the general theme. - */ - private void loadDefaultPage() { - loadPage(DEFAULT_PAGE.toExternalForm()); - } - -} diff --git a/src/main/java/seedu/address/ui/CommandBox.java b/src/main/java/seedu/address/ui/CommandBox.java index bf09f3dcbea6..8efd5140ad98 100644 --- a/src/main/java/seedu/address/ui/CommandBox.java +++ b/src/main/java/seedu/address/ui/CommandBox.java @@ -4,9 +4,9 @@ import javafx.collections.ObservableList; import javafx.fxml.FXML; -import javafx.scene.control.TextField; import javafx.scene.input.KeyEvent; import javafx.scene.layout.Region; +import seedu.address.commons.core.Commands; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.parser.exceptions.ParseException; @@ -15,8 +15,6 @@ * The UI component that is responsible for receiving user command inputs. */ public class CommandBox extends UiPart { - - public static final String ERROR_STYLE_CLASS = "error"; private static final String FXML = "CommandBox.fxml"; private final CommandExecutor commandExecutor; @@ -24,15 +22,14 @@ public class CommandBox extends UiPart { private ListElementPointer historySnapshot; @FXML - private TextField commandTextField; + private AutoCompleteTextField commandTextField; public CommandBox(CommandExecutor commandExecutor, List history) { super(FXML); this.commandExecutor = commandExecutor; this.history = history; - // calls #setStyleToDefault() whenever there is a change to the text of the command box. - commandTextField.textProperty().addListener((unused1, unused2, unused3) -> setStyleToDefault()); - historySnapshot = new ListElementPointer(history); + this.historySnapshot = new ListElementPointer(history); + this.commandTextField.getSuggestions().addAll(Commands.getAllCommands()); } /** @@ -45,7 +42,6 @@ private void handleKeyPress(KeyEvent keyEvent) { // As up and down buttons will alter the position of the caret, // consuming it causes the caret's position to remain unchanged keyEvent.consume(); - navigateToPreviousInput(); break; case DOWN: @@ -118,24 +114,17 @@ private void initHistory() { historySnapshot.add(""); } - /** - * Sets the command box style to use the default style. - */ - private void setStyleToDefault() { - commandTextField.getStyleClass().remove(ERROR_STYLE_CLASS); - } - /** * Sets the command box style to indicate a failed command. */ private void setStyleToIndicateCommandFailure() { ObservableList styleClass = commandTextField.getStyleClass(); - if (styleClass.contains(ERROR_STYLE_CLASS)) { + if (styleClass.contains(AutoCompleteTextField.ERROR_STYLE_CLASS)) { return; } - styleClass.add(ERROR_STYLE_CLASS); + styleClass.add(AutoCompleteTextField.ERROR_STYLE_CLASS); } /** diff --git a/src/main/java/seedu/address/ui/HealthWorkerCard.java b/src/main/java/seedu/address/ui/HealthWorkerCard.java new file mode 100644 index 000000000000..c986cc1a4ee1 --- /dev/null +++ b/src/main/java/seedu/address/ui/HealthWorkerCard.java @@ -0,0 +1,84 @@ +package seedu.address.ui; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * An UI component that displays a simple card info of a {@code HealthWorker}, + * displaying its specialisation, as well as its availability. + * + * @author Hui Chun + */ +public class HealthWorkerCard extends UiPart { + + private static final String FXML = "HealthWorkerListCard.fxml"; + + /** + * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. + * As a consequence, UI elements' variable names cannot be set to such keywords + * or an exception will be thrown by JavaFX during runtime. + * + */ + + public final HealthWorker worker; + + @FXML + private BorderPane borderPane; + + @FXML + private VBox healthWorkerInfo; + + @FXML + private Label id; + + @FXML + private Label name; + + @FXML + private Label organisation; + + @FXML + private Label nric; + + @FXML + private Label phone; + + @FXML + private FlowPane specialisations; + + + public HealthWorkerCard(HealthWorker worker, int displayedIndex) { + super(FXML); + this.worker = worker; + this.id.setText(displayedIndex + ". "); + this.name.setText(worker.getName().toString()); + this.organisation.setText("(" + worker.getOrganization().toString() + ")"); + this.nric.setText(worker.getNric().toString()); + this.phone.setText(worker.getPhone().toString()); + this.worker.getSkills().getSkills().forEach(s -> + specialisations.getChildren().add(new Label(s.toString().toLowerCase()))); + } + + @Override + public boolean equals(Object other) { + // short circuit if same object + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof HealthWorkerCard)) { + return false; + } + + // state check + HealthWorkerCard card = (HealthWorkerCard) other; + return name.getText().equals(card.name.getText()) + && organisation.getText().equals(card.organisation.getText()); + } +} diff --git a/src/main/java/seedu/address/ui/HealthWorkerListPanel.java b/src/main/java/seedu/address/ui/HealthWorkerListPanel.java new file mode 100644 index 000000000000..6b6622b3d04b --- /dev/null +++ b/src/main/java/seedu/address/ui/HealthWorkerListPanel.java @@ -0,0 +1,77 @@ +package seedu.address.ui; + +import java.util.Objects; +import java.util.function.Consumer; +import java.util.logging.Logger; + +import javafx.beans.value.ObservableValue; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.scene.layout.Region; +import seedu.address.commons.core.LogsCenter; +import seedu.address.model.person.healthworker.HealthWorker; + +/** + * The HealthWorkerList Panel of the App. + * Responsible for constructing the health worker list panel via its individual + * {@code HealthWorker} cards and handling event logic. + * @author Hui Chun + */ +public class HealthWorkerListPanel extends UiPart { + private static final String FXML = "HealthWorkerListPanel.fxml"; + private final Logger logger = LogsCenter.getLogger(HealthWorkerListPanel.class); + + @FXML + private ListView healthWorkerListView; + + public HealthWorkerListPanel(ObservableList healthWorkerList, + ObservableValue selectedHealthWorker, + Consumer onSelectedHealthWorkerChange) { + super(FXML); + healthWorkerListView.setItems(healthWorkerList); + healthWorkerListView.setCellFactory(listView -> new HealthWorkerListPanel.HealthWorkerListCell()); + healthWorkerListView.getSelectionModel() + .selectedItemProperty().addListener((observable, oldValue, newValue) -> { + logger.fine("Selection in health worker list panel changed to : '" + newValue + "'"); + onSelectedHealthWorkerChange.accept(newValue); + }); + selectedHealthWorker.addListener((observable, oldValue, newValue) -> { + logger.fine("Selected health worker changed to: " + newValue); + + // Don't modify selection if we are already selecting the selected health worker, + // otherwise we would have an infinite loop. + if (Objects.equals(healthWorkerListView.getSelectionModel().getSelectedItem(), newValue)) { + return; + } + + if (newValue == null) { + healthWorkerListView.getSelectionModel().clearSelection(); + } else { + logger.info("NEW HEALTH WORKER" + newValue); + int index = healthWorkerListView.getItems().indexOf(newValue); + healthWorkerListView.scrollTo(index); + healthWorkerListView.getSelectionModel().clearAndSelect(index); + } + }); + + } + + /** + * Custom {@code ListCell} that displays the graphics of a {@code HealthWorker} using a {@code HealthWorkerCard}. + */ + class HealthWorkerListCell extends ListCell { + @Override + protected void updateItem(HealthWorker worker, boolean empty) { + super.updateItem(worker, empty); + + if (empty || worker == null) { + setGraphic(null); + setText(null); + } else { + setGraphic(new HealthWorkerCard(worker, getIndex() + 1).getRoot()); + } + } + } +} diff --git a/src/main/java/seedu/address/ui/InfoPanel.java b/src/main/java/seedu/address/ui/InfoPanel.java new file mode 100644 index 000000000000..bc6f7fc137d4 --- /dev/null +++ b/src/main/java/seedu/address/ui/InfoPanel.java @@ -0,0 +1,199 @@ +package seedu.address.ui; + +import static java.util.Objects.requireNonNull; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Base64; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +import javafx.application.Platform; +import javafx.beans.value.ObservableValue; +import javafx.event.Event; +import javafx.fxml.FXML; +import javafx.scene.layout.Region; +import javafx.scene.web.WebView; +import seedu.address.MainApp; +import seedu.address.commons.core.LogsCenter; +import seedu.address.model.request.Request; +import seedu.address.model.tag.Condition; + +/** + * The Info Panel of the App. + * Responsible for displaying the request details when selected. + * Map is rendered via URL request to gothere.sg. + * For more info, visit https://gothere.sg/api/maps/staticmaps.html. + * @author Hui Chun + */ +public class InfoPanel extends UiPart { + + public static final URL DEFAULT_PAGE = + requireNonNull(MainApp.class.getResource(FXML_FILE_FOLDER + "default.html")); + public static final URL STYLESHEET = + requireNonNull(MainApp.class.getResource(FXML_FILE_FOLDER + "WhiteTheme.css")); + public static final URL FA_STYLESHEET = + requireNonNull(MainApp.class.getResource(FA_FILE_FOLDER + "css/all.min.css")); + + private static final String FXML = "InfoPanel.fxml"; + + private final Logger logger = LogsCenter.getLogger(getClass()); + + @FXML + private WebView webView; + + public InfoPanel(ObservableValue selectedRequest) { + super(FXML); + + // To prevent triggering events for typing inside the loaded Web page. + getRoot().setOnKeyPressed(Event::consume); + + loadDefaultPage(); + + // Attaches a listener that displays the request details when selected. + selectedRequest.addListener((observable, oldValue, newValue) -> { + logger.info("InfoPanel triggered on request selection."); + + if (newValue == null) { + return; + } + + Request request = selectedRequest.getValue(); + String htmlContent = generateHtml(request); + loadContent(htmlContent); + }); + } + + /** + * Loads a default HTML file that displays the welcome message and starter tips. + */ + private void loadDefaultPage() { + loadPage(DEFAULT_PAGE.toExternalForm()); + } + + /** + * Loads a normal web page. + * @param url + */ + public void loadPage(String url) { + Platform.runLater(() -> webView.getEngine().load(url)); + } + + /** + * Loads the given HTML content directly into the web engine. + * @param htmlContent + */ + public void loadContent(String htmlContent) { + Platform.runLater(() -> webView.getEngine().loadContent(htmlContent)); + } + + /** + * Generates the entire HTML structure via this method. + * Takes in a {@code request} object and the StringBuilder appends its properties. + * @param request + * @return a string of HTML content + */ + public String generateHtml(Request request) { + + String name = request.getName().toString(); + String nric = request.getNric().toString(); + String phone = request.getPhone().toString(); + String address = request.getAddress().toString(); + String conditions = request.getConditions().stream().map(Condition::toString).collect( + Collectors.joining(", ")); + String healthStaff = request.getHealthStaff(); + String date = request.getRequestDate().getFormattedDate(); + String status = request.getRequestStatus().toString(); + String street = request.getAddress().toStreetNameOnly(); + String url = constructMapUrl(street); + + //logger.info(street); + StringBuilder htmlBuilder = new StringBuilder(); + htmlBuilder.append(""); + htmlBuilder.append(""); + htmlBuilder.append(""); + htmlBuilder.append("
"); + htmlBuilder.append(" Request Patient: " + name + "
"); + htmlBuilder.append(" Patient NRIC: " + nric + "
"); + htmlBuilder.append(" Patient Contact: " + phone + "
"); + htmlBuilder.append(" Patient Address: " + address + "
"); + htmlBuilder.append(" Patient Conditions: " + conditions + "
"); + if (request.getHealthStaff() != null) { // show staff name + htmlBuilder.append(" Assigned Staff: " + healthStaff + "
"); + } else { + htmlBuilder.append(" Assigned Staff: Not Assigned
"); + } + htmlBuilder.append(" Appt. Date: " + date + "
"); + if (status == "PENDING") { + htmlBuilder.append(" Request Status: " + status + "

"); + } else { // if ongoing or completed + htmlBuilder.append(" Request Status: " + status + "

"); + } + + try { + htmlBuilder.append(getEncodedImage(url)); + } catch (IOException e) { + htmlBuilder.append("Unable to view address location in map."); + } + htmlBuilder.append(""); + + return htmlBuilder.toString(); + } + + /** + * Constructs the URL for accessing the static map. + * Takes in an {@code address} string and extracts only the street details. + * @param address + * @return a url string to access the map + */ + private String constructMapUrl(String address) { + StringBuilder urlBuilder = new StringBuilder(); + address = address.replaceAll("\\s", "%20"); + urlBuilder.append("https://gothere.sg/maps/staticmap?center=%22"); + urlBuilder.append(address + "%22&zoom=16&size=400x200&markers=%22"); + urlBuilder.append(address + "%22,orange&sensor=false"); + //logger.info(urlBuilder.toString()); + return urlBuilder.toString(); + } + + /** + * This method opens a {@code HTTPURLConnection} object by supplying in the url. + * Sets the request method as "GET" and retrieves the {@code BufferedInputStream} object + * from the connection, then encodes the bytes to a string to display in the HTML content. + * Reference: https://dzone.com/articles/how-to-implement-get-and-post-request-through-simp + * @param url + * @return a base64 representation of an image + * @throws IOException + */ + private String getEncodedImage(String url) throws IOException { + URL urlForGetRequest = new URL(url); + byte[] imageBytes = new byte[0]; + + try { + HttpURLConnection connection = (HttpURLConnection) urlForGetRequest.openConnection(); + connection.setRequestMethod("GET"); + int responseCode = connection.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedInputStream bis = new BufferedInputStream(connection.getInputStream()); + //logger.info("AVAILABLE BYTES: " + bis.available()); + if (bis.available() != 0) { // if there are bytes to read from InputStream + for (byte[] byteArray = new byte[bis.available()]; + bis.read(byteArray) != -1; ) { + byte[] temp = new byte[imageBytes.length + byteArray.length]; + System.arraycopy(imageBytes, 0, temp, 0, imageBytes.length); + System.arraycopy(byteArray, 0, temp, imageBytes.length, byteArray.length); + imageBytes = temp; + } + } else { + return "Unable to view address location in map."; + } + } + } catch (IOException io) { + throw new IOException(io.getMessage()); + } + return ""; + } +} diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index ac165736001d..9b6b70864bdf 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -20,6 +20,7 @@ /** * The Main Window. Provides the basic application layout containing * a menu bar and space where other JavaFX elements can be placed. + * @author Hui Chun */ public class MainWindow extends UiPart { @@ -30,29 +31,37 @@ public class MainWindow extends UiPart { private Stage primaryStage; private Logic logic; - // Independent Ui parts residing in this Ui container - private BrowserPanel browserPanel; - private PersonListPanel personListPanel; - private ResultDisplay resultDisplay; + // Independent UI parts residing in this UI container private HelpWindow helpWindow; + private ResultDisplay resultDisplay; + private RequestListPanel requestListPanel; + private InfoPanel infoPanel; + private HealthWorkerListPanel healthWorkerListPanel; + private StatusBarFooter statusBarFooter; @FXML - private StackPane browserPlaceholder; + private MenuItem helpMenuItem; + + @FXML + private MenuItem feedbackMenuItem; @FXML private StackPane commandBoxPlaceholder; @FXML - private MenuItem helpMenuItem; + private StackPane resultDisplayPlaceholder; @FXML - private StackPane personListPanelPlaceholder; + private StackPane requestListPlaceholder; @FXML - private StackPane resultDisplayPlaceholder; + private StackPane displayInfoPlaceholder; + + @FXML + private StackPane healthWorkerListPlaceholder; @FXML - private StackPane statusbarPlaceholder; + private StackPane statusBarPlaceholder; public MainWindow(Stage primaryStage, Logic logic) { super(FXML, primaryStage); @@ -75,6 +84,7 @@ public Stage getPrimaryStage() { private void setAccelerators() { setAccelerator(helpMenuItem, KeyCombination.valueOf("F1")); + setAccelerator(feedbackMenuItem, KeyCombination.valueOf("F2")); } /** @@ -111,21 +121,30 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { - browserPanel = new BrowserPanel(logic.selectedPersonProperty()); - browserPlaceholder.getChildren().add(browserPanel.getRoot()); - - personListPanel = new PersonListPanel(logic.getFilteredPersonList(), logic.selectedPersonProperty(), - logic::setSelectedPerson); - personListPanelPlaceholder.getChildren().add(personListPanel.getRoot()); + CommandBox commandBox = new CommandBox(this::executeCommand, logic.getHistory()); + commandBoxPlaceholder.getChildren().add(commandBox.getRoot()); resultDisplay = new ResultDisplay(); resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot()); - StatusBarFooter statusBarFooter = new StatusBarFooter(logic.getAddressBookFilePath(), logic.getAddressBook()); - statusbarPlaceholder.getChildren().add(statusBarFooter.getRoot()); + requestListPanel = new RequestListPanel(logic.getFilteredRequestList(), logic.selectedRequestProperty(), + logic::setSelectedRequest); + requestListPlaceholder.getChildren().add(requestListPanel.getRoot()); - CommandBox commandBox = new CommandBox(this::executeCommand, logic.getHistory()); - commandBoxPlaceholder.getChildren().add(commandBox.getRoot()); + infoPanel = new InfoPanel(logic.selectedRequestProperty()); + displayInfoPlaceholder.getChildren().add(infoPanel.getRoot()); + + healthWorkerListPanel = new HealthWorkerListPanel(logic.getFilteredHealthWorkerList(), + logic.selectedHealthWorkerProperty(), logic::setSelectedHealthWorker); + healthWorkerListPlaceholder.getChildren().add(healthWorkerListPanel.getRoot()); + + statusBarFooter = new StatusBarFooter(logic.getRequestBookFilePath(), logic.getHealthWorkerBookFilePath(), + logic.getRequestBook(), logic.getHealthWorkerBook()); + statusBarPlaceholder.getChildren().add(statusBarFooter.getRoot()); + } + + void show() { + primaryStage.show(); } /** @@ -152,8 +171,12 @@ public void handleHelp() { } } - void show() { - primaryStage.show(); + /** + * Opens the feedback window. + */ + @FXML + public void handleFeedback() { + //TODO implement feedback window logic } /** @@ -168,14 +191,10 @@ private void handleExit() { primaryStage.hide(); } - public PersonListPanel getPersonListPanel() { - return personListPanel; - } - /** * Executes the command and returns the result. * - * @see seedu.address.logic.Logic#execute(String) + * @see Logic#execute(String) */ private CommandResult executeCommand(String commandText) throws CommandException, ParseException { try { diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java deleted file mode 100644 index f6727ea83abd..000000000000 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ /dev/null @@ -1,70 +0,0 @@ -package seedu.address.ui; - -import javafx.fxml.FXML; -import javafx.scene.control.Label; -import javafx.scene.layout.FlowPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.Region; -import seedu.address.model.person.Person; - -/** - * An UI component that displays information of a {@code Person}. - */ -public class PersonCard extends UiPart { - - private static final String FXML = "PersonListCard.fxml"; - - /** - * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. - * As a consequence, UI elements' variable names cannot be set to such keywords - * or an exception will be thrown by JavaFX during runtime. - * - * @see The issue on AddressBook level 4 - */ - - public final Person person; - - @FXML - private HBox cardPane; - @FXML - private Label name; - @FXML - private Label id; - @FXML - private Label phone; - @FXML - private Label address; - @FXML - private Label email; - @FXML - private FlowPane tags; - - public PersonCard(Person person, int displayedIndex) { - super(FXML); - this.person = person; - id.setText(displayedIndex + ". "); - name.setText(person.getName().fullName); - phone.setText(person.getPhone().value); - address.setText(person.getAddress().value); - email.setText(person.getEmail().value); - person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); - } - - @Override - public boolean equals(Object other) { - // short circuit if same object - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof PersonCard)) { - return false; - } - - // state check - PersonCard card = (PersonCard) other; - return id.getText().equals(card.id.getText()) - && person.equals(card.person); - } -} diff --git a/src/main/java/seedu/address/ui/PersonListPanel.java b/src/main/java/seedu/address/ui/PersonListPanel.java deleted file mode 100644 index 5ca3fa4fc671..000000000000 --- a/src/main/java/seedu/address/ui/PersonListPanel.java +++ /dev/null @@ -1,71 +0,0 @@ -package seedu.address.ui; - -import java.util.Objects; -import java.util.function.Consumer; -import java.util.logging.Logger; - -import javafx.beans.value.ObservableValue; -import javafx.collections.ObservableList; -import javafx.fxml.FXML; -import javafx.scene.control.ListCell; -import javafx.scene.control.ListView; -import javafx.scene.layout.Region; -import seedu.address.commons.core.LogsCenter; -import seedu.address.model.person.Person; - -/** - * Panel containing the list of persons. - */ -public class PersonListPanel extends UiPart { - private static final String FXML = "PersonListPanel.fxml"; - private final Logger logger = LogsCenter.getLogger(PersonListPanel.class); - - @FXML - private ListView personListView; - - public PersonListPanel(ObservableList personList, ObservableValue selectedPerson, - Consumer onSelectedPersonChange) { - super(FXML); - personListView.setItems(personList); - personListView.setCellFactory(listView -> new PersonListViewCell()); - personListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { - logger.fine("Selection in person list panel changed to : '" + newValue + "'"); - onSelectedPersonChange.accept(newValue); - }); - selectedPerson.addListener((observable, oldValue, newValue) -> { - logger.fine("Selected person changed to: " + newValue); - - // Don't modify selection if we are already selecting the selected person, - // otherwise we would have an infinite loop. - if (Objects.equals(personListView.getSelectionModel().getSelectedItem(), newValue)) { - return; - } - - if (newValue == null) { - personListView.getSelectionModel().clearSelection(); - } else { - int index = personListView.getItems().indexOf(newValue); - personListView.scrollTo(index); - personListView.getSelectionModel().clearAndSelect(index); - } - }); - } - - /** - * Custom {@code ListCell} that displays the graphics of a {@code Person} using a {@code PersonCard}. - */ - class PersonListViewCell extends ListCell { - @Override - protected void updateItem(Person person, boolean empty) { - super.updateItem(person, empty); - - if (empty || person == null) { - setGraphic(null); - setText(null); - } else { - setGraphic(new PersonCard(person, getIndex() + 1).getRoot()); - } - } - } - -} diff --git a/src/main/java/seedu/address/ui/RequestCard.java b/src/main/java/seedu/address/ui/RequestCard.java new file mode 100644 index 000000000000..04517d2f8332 --- /dev/null +++ b/src/main/java/seedu/address/ui/RequestCard.java @@ -0,0 +1,93 @@ +package seedu.address.ui; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Region; +import javafx.scene.paint.Color; +import seedu.address.model.request.Request; + +/** + * An UI component that displays information of a {@code Request}. + */ +public class RequestCard extends UiPart { + + private static final String FXML = "RequestListCard.fxml"; + + /** + * Note: Certain keywords such as "location" and "resources" are reserved keywords in JavaFX. + * As a consequence, UI elements' variable names cannot be set to such keywords + * or an exception will be thrown by JavaFX during runtime. + * + */ + + public final Request request; + + @FXML + private HBox cardPane; + @FXML + private Label id; + @FXML + private Label name; + @FXML + private Label nric; + @FXML + private Label phone; + @FXML + private Label address; + @FXML + private FlowPane conditions; + @FXML + private Label date; + @FXML + private Label status; + + public RequestCard(Request request, int displayedIndex) { + super(FXML); + this.request = request; + this.id.setText(displayedIndex + ". "); + this.name.setText(request.getName().toString()); + this.nric.setText("(" + request.getNric().toString() + ")"); + this.phone.setText(request.getPhone().value); + this.address.setText(request.getAddress().toString()); + this.request.getConditions().forEach(c -> + this.conditions.getChildren().add(new Label(c.toString()))); + this.date.setText("Appt. Date: " + request.getRequestDate().getFormattedDate()); + + String requestStatus = request.getRequestStatus().toString(); + this.status.setText(requestStatus); + + switch (requestStatus) { + case "PENDING": // red light + this.status.setTextFill(Color.web("#F22613")); + break; + case "ONGOING": // yellow light + this.status.setTextFill(Color.web("#FFA400")); + break; + case "COMPLETED": // green light + this.status.setTextFill(Color.web("#00E640")); + break; + default: + break; + } + } + + @Override + public boolean equals(Object other) { + // short circuit if same object + if (other == this) { + return true; + } + + // instanceof handles nulls + if (!(other instanceof RequestCard)) { + return false; + } + + // state check + RequestCard card = (RequestCard) other; + return id.getText().equals(card.id.getText()) + && request.equals(card.request); + } +} diff --git a/src/main/java/seedu/address/ui/RequestListPanel.java b/src/main/java/seedu/address/ui/RequestListPanel.java new file mode 100644 index 000000000000..6ee28abb8721 --- /dev/null +++ b/src/main/java/seedu/address/ui/RequestListPanel.java @@ -0,0 +1,71 @@ +package seedu.address.ui; + +import java.util.Objects; +import java.util.function.Consumer; +import java.util.logging.Logger; + +import javafx.beans.value.ObservableValue; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.scene.layout.Region; +import seedu.address.commons.core.LogsCenter; +import seedu.address.model.request.Request; + +/** + * A panel containing the list of requests on the UI. + * @author Hui Chun + */ +public class RequestListPanel extends UiPart { + private static final String FXML = "RequestListPanel.fxml"; + private final Logger logger = LogsCenter.getLogger(RequestListPanel.class); + + @FXML + private ListView requestListView; + + public RequestListPanel(ObservableList requestList, ObservableValue selectedRequest, + Consumer onSelectedRequestChange) { + super(FXML); + requestListView.setItems(requestList); + requestListView.setCellFactory(listView -> new RequestListViewCell()); + requestListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + //logger.info("Selection in request list panel changed to: " + newValue); + onSelectedRequestChange.accept(newValue); + }); + selectedRequest.addListener((observable, oldValue, newValue) -> { + + // Don't modify selection if we are already selecting the selected request, + // otherwise we would have an infinite loop. + if (Objects.equals(requestListView.getSelectionModel().getSelectedItem(), newValue)) { + return; + } + + if (newValue == null) { + requestListView.getSelectionModel().clearSelection(); + } else { + int index = requestListView.getItems().indexOf(newValue); + requestListView.scrollTo(index); + requestListView.getSelectionModel().clearAndSelect(index); + } + }); + } + + /** + * Custom {@code ListCell} that displays the graphics of a {@code Request} using a {@code RequestCard}. + */ + class RequestListViewCell extends ListCell { + @Override + protected void updateItem(Request request, boolean empty) { + super.updateItem(request, empty); + + if (empty || request == null) { + setGraphic(null); + setText(null); + } else { + setGraphic(new RequestCard(request, getIndex() + 1).getRoot()); + } + } + } + +} diff --git a/src/main/java/seedu/address/ui/StatusBarFooter.java b/src/main/java/seedu/address/ui/StatusBarFooter.java index b22e1f525256..960ff7c4a630 100644 --- a/src/main/java/seedu/address/ui/StatusBarFooter.java +++ b/src/main/java/seedu/address/ui/StatusBarFooter.java @@ -2,13 +2,15 @@ import java.nio.file.Path; import java.nio.file.Paths; +import java.text.SimpleDateFormat; import java.time.Clock; import java.util.Date; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.layout.Region; -import seedu.address.model.ReadOnlyAddressBook; +import seedu.address.model.ReadOnlyHealthWorkerBook; +import seedu.address.model.ReadOnlyRequestBook; /** * A ui for the status bar that is displayed at the footer of the application. @@ -30,17 +32,22 @@ public class StatusBarFooter extends UiPart { private static final String FXML = "StatusBarFooter.fxml"; + private static final String REQUEST_BOOK = "RequestBook"; + + private static final String HEALTH_WORKER_BOOK = "HealthWorkerBook"; + @FXML private Label syncStatus; @FXML private Label saveLocationStatus; - public StatusBarFooter(Path saveLocation, ReadOnlyAddressBook addressBook) { + public StatusBarFooter(Path requestBookPath, Path healthWorkerBookPath, ReadOnlyRequestBook requestBook, + ReadOnlyHealthWorkerBook healthWorkerBook) { super(FXML); - addressBook.addListener(observable -> updateSyncStatus()); + requestBook.addListener(observable -> updateSyncStatus(REQUEST_BOOK, requestBookPath)); + healthWorkerBook.addListener(observable -> updateSyncStatus(HEALTH_WORKER_BOOK, healthWorkerBookPath)); syncStatus.setText(SYNC_STATUS_INITIAL); - saveLocationStatus.setText(Paths.get(".").resolve(saveLocation).toString()); } /** @@ -60,10 +67,21 @@ public static Clock getClock() { /** * Updates "last updated" status to the current time. */ - private void updateSyncStatus() { + private void updateSyncStatus(String bookType, Path path) { + SimpleDateFormat formatter = new SimpleDateFormat("dd MMMM YYYY, hh:mm a"); long now = clock.millis(); - String lastUpdated = new Date(now).toString(); + String lastUpdated = formatter.format(new Date(now)); syncStatus.setText(String.format(SYNC_STATUS_UPDATED, lastUpdated)); + switch(bookType) { + case REQUEST_BOOK: + saveLocationStatus.setText(Paths.get(".").resolve(path).toString()); + break; + case HEALTH_WORKER_BOOK: + saveLocationStatus.setText(Paths.get(".").resolve(path).toString()); + break; + default: + // do nothing + } } } diff --git a/src/main/java/seedu/address/ui/UiManager.java b/src/main/java/seedu/address/ui/UiManager.java index 876621d79b94..76fa2e558e0b 100644 --- a/src/main/java/seedu/address/ui/UiManager.java +++ b/src/main/java/seedu/address/ui/UiManager.java @@ -18,9 +18,8 @@ public class UiManager implements Ui { public static final String ALERT_DIALOG_PANE_FIELD_ID = "alertDialogPane"; - private static final Logger logger = LogsCenter.getLogger(UiManager.class); - private static final String ICON_APPLICATION = "/images/address_book_32.png"; + private static final String ICON_APPLICATION = "/images/health_hub_32.png"; private Logic logic; private MainWindow mainWindow; @@ -30,13 +29,40 @@ public UiManager(Logic logic) { this.logic = logic; } + /** + * Shows an alert dialog on {@code owner} with the given parameters. + * This method only returns after the user has closed the alert dialog. + */ + private static void showAlertDialogAndWait(Stage owner, AlertType type, String title, String headerText, + String contentText) { + final Alert alert = new Alert(type); + alert.getDialogPane().getStylesheets().add("view/WhiteTheme.css"); + alert.initOwner(owner); + alert.setTitle(title); + alert.setHeaderText(headerText); + alert.setContentText(contentText); + alert.getDialogPane().setId(ALERT_DIALOG_PANE_FIELD_ID); + alert.showAndWait(); + } + + void showAlertDialogAndWait(Alert.AlertType type, String title, String headerText, String contentText) { + showAlertDialogAndWait(mainWindow.getPrimaryStage(), type, title, headerText, contentText); + } + + private Image getImage(String imagePath) { + return new Image(MainApp.class.getResourceAsStream(imagePath)); + } + @Override public void start(Stage primaryStage) { logger.info("Starting UI..."); - //Set the application icon. + // Sets the application icon. primaryStage.getIcons().add(getImage(ICON_APPLICATION)); + // Sets the stage size to be maximized. + primaryStage.setMaximized(true); + try { mainWindow = new MainWindow(primaryStage, logic); mainWindow.show(); //This should be called before creating other UI parts @@ -48,30 +74,6 @@ public void start(Stage primaryStage) { } } - private Image getImage(String imagePath) { - return new Image(MainApp.class.getResourceAsStream(imagePath)); - } - - void showAlertDialogAndWait(Alert.AlertType type, String title, String headerText, String contentText) { - showAlertDialogAndWait(mainWindow.getPrimaryStage(), type, title, headerText, contentText); - } - - /** - * Shows an alert dialog on {@code owner} with the given parameters. - * This method only returns after the user has closed the alert dialog. - */ - private static void showAlertDialogAndWait(Stage owner, AlertType type, String title, String headerText, - String contentText) { - final Alert alert = new Alert(type); - alert.getDialogPane().getStylesheets().add("view/DarkTheme.css"); - alert.initOwner(owner); - alert.setTitle(title); - alert.setHeaderText(headerText); - alert.setContentText(contentText); - alert.getDialogPane().setId(ALERT_DIALOG_PANE_FIELD_ID); - alert.showAndWait(); - } - /** * Shows an error alert dialog with {@code title} and error message, {@code e}, * and exits the application after the user has closed the alert dialog. diff --git a/src/main/java/seedu/address/ui/UiPart.java b/src/main/java/seedu/address/ui/UiPart.java index fc820e01a9c3..cf018d18f0fc 100644 --- a/src/main/java/seedu/address/ui/UiPart.java +++ b/src/main/java/seedu/address/ui/UiPart.java @@ -17,6 +17,9 @@ public abstract class UiPart { /** Resource folder where FXML files are stored. */ public static final String FXML_FILE_FOLDER = "/view/"; + /** Resource folder where font-awesome files are stored. */ + public static final String FA_FILE_FOLDER = "/font-awesome/"; + private final FXMLLoader fxmlLoader = new FXMLLoader(); /** diff --git a/src/main/resources/font-awesome/css/all.min.css b/src/main/resources/font-awesome/css/all.min.css new file mode 100644 index 000000000000..208853469e6d --- /dev/null +++ b/src/main/resources/font-awesome/css/all.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-balance-scale:before{content:"\f24e"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-wizard:before{content:"\f6e8"}.fa-haykal:before{content:"\f666"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-nintendo-switch:before{content:"\f418"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-volume:before{content:"\f2a0"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:normal;font-display:auto;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:auto;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:auto;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} diff --git a/src/main/resources/font-awesome/css/brands.min.css b/src/main/resources/font-awesome/css/brands.min.css new file mode 100644 index 000000000000..1c75c914d684 --- /dev/null +++ b/src/main/resources/font-awesome/css/brands.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:normal;font-display:auto;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"} diff --git a/src/main/resources/font-awesome/css/fontawesome.min.css b/src/main/resources/font-awesome/css/fontawesome.min.css new file mode 100644 index 000000000000..6f90b77b1934 --- /dev/null +++ b/src/main/resources/font-awesome/css/fontawesome.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-balance-scale:before{content:"\f24e"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-handshake:before{content:"\f2b5"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-wizard:before{content:"\f6e8"}.fa-haykal:before{content:"\f666"}.fa-hdd:before{content:"\f0a0"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-nintendo-switch:before{content:"\f418"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-volume:before{content:"\f2a0"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto} diff --git a/src/main/resources/font-awesome/css/regular.min.css b/src/main/resources/font-awesome/css/regular.min.css new file mode 100644 index 000000000000..fa1302f51999 --- /dev/null +++ b/src/main/resources/font-awesome/css/regular.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:auto;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.far{font-family:"Font Awesome 5 Free";font-weight:400} diff --git a/src/main/resources/font-awesome/css/solid.min.css b/src/main/resources/font-awesome/css/solid.min.css new file mode 100644 index 000000000000..3260b335082f --- /dev/null +++ b/src/main/resources/font-awesome/css/solid.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:auto;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.fas{font-family:"Font Awesome 5 Free";font-weight:900} diff --git a/src/main/resources/font-awesome/css/svg-with-js.min.css b/src/main/resources/font-awesome/css/svg-with-js.min.css new file mode 100644 index 000000000000..60e814f14aa6 --- /dev/null +++ b/src/main/resources/font-awesome/css/svg-with-js.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.svg-inline--fa,svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;transform:translate(-50%,-50%);transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;transform:scale(.25);transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;transform:scale(.25);transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;transform:scale(.25);transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;transform:scale(.25);transform-origin:top left}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{animation:fa-spin 2s infinite linear}.fa-pulse{animation:fa-spin 1s infinite steps(8)}@keyframes fa-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2.5em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1.25em}.svg-inline--fa.fa-stack-2x{height:2em;width:2.5em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto} diff --git a/src/main/resources/font-awesome/css/v4-shims.min.css b/src/main/resources/font-awesome/css/v4-shims.min.css new file mode 100644 index 000000000000..40e8d4618d72 --- /dev/null +++ b/src/main/resources/font-awesome/css/v4-shims.min.css @@ -0,0 +1,5 @@ +/*! + * Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +.fa.fa-glass:before{content:"\f000"}.fa.fa-meetup{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-star-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-star-o:before{content:"\f005"}.fa.fa-close:before,.fa.fa-remove:before{content:"\f00d"}.fa.fa-gear:before{content:"\f013"}.fa.fa-trash-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-trash-o:before{content:"\f2ed"}.fa.fa-file-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-o:before{content:"\f15b"}.fa.fa-clock-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-clock-o:before{content:"\f017"}.fa.fa-arrow-circle-o-down{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-arrow-circle-o-down:before{content:"\f358"}.fa.fa-arrow-circle-o-up{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-arrow-circle-o-up:before{content:"\f35b"}.fa.fa-play-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-play-circle-o:before{content:"\f144"}.fa.fa-repeat:before,.fa.fa-rotate-right:before{content:"\f01e"}.fa.fa-refresh:before{content:"\f021"}.fa.fa-list-alt{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-dedent:before{content:"\f03b"}.fa.fa-video-camera:before{content:"\f03d"}.fa.fa-picture-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-picture-o:before{content:"\f03e"}.fa.fa-photo{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-photo:before{content:"\f03e"}.fa.fa-image{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-image:before{content:"\f03e"}.fa.fa-pencil:before{content:"\f303"}.fa.fa-map-marker:before{content:"\f3c5"}.fa.fa-pencil-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-pencil-square-o:before{content:"\f044"}.fa.fa-share-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-share-square-o:before{content:"\f14d"}.fa.fa-check-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-check-square-o:before{content:"\f14a"}.fa.fa-arrows:before{content:"\f0b2"}.fa.fa-times-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-times-circle-o:before{content:"\f057"}.fa.fa-check-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-check-circle-o:before{content:"\f058"}.fa.fa-mail-forward:before{content:"\f064"}.fa.fa-eye,.fa.fa-eye-slash{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-warning:before{content:"\f071"}.fa.fa-calendar:before{content:"\f073"}.fa.fa-arrows-v:before{content:"\f338"}.fa.fa-arrows-h:before{content:"\f337"}.fa.fa-bar-chart{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-bar-chart:before{content:"\f080"}.fa.fa-bar-chart-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-bar-chart-o:before{content:"\f080"}.fa.fa-facebook-square,.fa.fa-twitter-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-gears:before{content:"\f085"}.fa.fa-thumbs-o-up{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-thumbs-o-up:before{content:"\f164"}.fa.fa-thumbs-o-down{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-thumbs-o-down:before{content:"\f165"}.fa.fa-heart-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-heart-o:before{content:"\f004"}.fa.fa-sign-out:before{content:"\f2f5"}.fa.fa-linkedin-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-linkedin-square:before{content:"\f08c"}.fa.fa-thumb-tack:before{content:"\f08d"}.fa.fa-external-link:before{content:"\f35d"}.fa.fa-sign-in:before{content:"\f2f6"}.fa.fa-github-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-lemon-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-lemon-o:before{content:"\f094"}.fa.fa-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-square-o:before{content:"\f0c8"}.fa.fa-bookmark-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-bookmark-o:before{content:"\f02e"}.fa.fa-facebook,.fa.fa-twitter{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-facebook:before{content:"\f39e"}.fa.fa-facebook-f{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-facebook-f:before{content:"\f39e"}.fa.fa-github{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-credit-card{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-feed:before{content:"\f09e"}.fa.fa-hdd-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hdd-o:before{content:"\f0a0"}.fa.fa-hand-o-right{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-o-right:before{content:"\f0a4"}.fa.fa-hand-o-left{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-o-left:before{content:"\f0a5"}.fa.fa-hand-o-up{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-o-up:before{content:"\f0a6"}.fa.fa-hand-o-down{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-o-down:before{content:"\f0a7"}.fa.fa-arrows-alt:before{content:"\f31e"}.fa.fa-group:before{content:"\f0c0"}.fa.fa-chain:before{content:"\f0c1"}.fa.fa-scissors:before{content:"\f0c4"}.fa.fa-files-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-files-o:before{content:"\f0c5"}.fa.fa-floppy-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-floppy-o:before{content:"\f0c7"}.fa.fa-navicon:before,.fa.fa-reorder:before{content:"\f0c9"}.fa.fa-google-plus,.fa.fa-google-plus-square,.fa.fa-pinterest,.fa.fa-pinterest-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-google-plus:before{content:"\f0d5"}.fa.fa-money{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-money:before{content:"\f3d1"}.fa.fa-unsorted:before{content:"\f0dc"}.fa.fa-sort-desc:before{content:"\f0dd"}.fa.fa-sort-asc:before{content:"\f0de"}.fa.fa-linkedin{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-linkedin:before{content:"\f0e1"}.fa.fa-rotate-left:before{content:"\f0e2"}.fa.fa-legal:before{content:"\f0e3"}.fa.fa-dashboard:before,.fa.fa-tachometer:before{content:"\f3fd"}.fa.fa-comment-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-comment-o:before{content:"\f075"}.fa.fa-comments-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-comments-o:before{content:"\f086"}.fa.fa-flash:before{content:"\f0e7"}.fa.fa-clipboard,.fa.fa-paste{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-paste:before{content:"\f328"}.fa.fa-lightbulb-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-lightbulb-o:before{content:"\f0eb"}.fa.fa-exchange:before{content:"\f362"}.fa.fa-cloud-download:before{content:"\f381"}.fa.fa-cloud-upload:before{content:"\f382"}.fa.fa-bell-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-bell-o:before{content:"\f0f3"}.fa.fa-cutlery:before{content:"\f2e7"}.fa.fa-file-text-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-text-o:before{content:"\f15c"}.fa.fa-building-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-building-o:before{content:"\f1ad"}.fa.fa-hospital-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hospital-o:before{content:"\f0f8"}.fa.fa-tablet:before{content:"\f3fa"}.fa.fa-mobile-phone:before,.fa.fa-mobile:before{content:"\f3cd"}.fa.fa-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-circle-o:before{content:"\f111"}.fa.fa-mail-reply:before{content:"\f3e5"}.fa.fa-github-alt{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-folder-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-folder-o:before{content:"\f07b"}.fa.fa-folder-open-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-folder-open-o:before{content:"\f07c"}.fa.fa-smile-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-smile-o:before{content:"\f118"}.fa.fa-frown-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-frown-o:before{content:"\f119"}.fa.fa-meh-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-meh-o:before{content:"\f11a"}.fa.fa-keyboard-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-keyboard-o:before{content:"\f11c"}.fa.fa-flag-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-flag-o:before{content:"\f024"}.fa.fa-mail-reply-all:before{content:"\f122"}.fa.fa-star-half-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-star-half-o:before{content:"\f089"}.fa.fa-star-half-empty{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-star-half-empty:before{content:"\f089"}.fa.fa-star-half-full{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-star-half-full:before{content:"\f089"}.fa.fa-code-fork:before{content:"\f126"}.fa.fa-chain-broken:before{content:"\f127"}.fa.fa-shield:before{content:"\f3ed"}.fa.fa-calendar-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-calendar-o:before{content:"\f133"}.fa.fa-css3,.fa.fa-html5,.fa.fa-maxcdn{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-ticket:before{content:"\f3ff"}.fa.fa-minus-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-minus-square-o:before{content:"\f146"}.fa.fa-level-up:before{content:"\f3bf"}.fa.fa-level-down:before{content:"\f3be"}.fa.fa-pencil-square:before{content:"\f14b"}.fa.fa-external-link-square:before{content:"\f360"}.fa.fa-compass{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-caret-square-o-down{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-caret-square-o-down:before{content:"\f150"}.fa.fa-toggle-down{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-toggle-down:before{content:"\f150"}.fa.fa-caret-square-o-up{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-caret-square-o-up:before{content:"\f151"}.fa.fa-toggle-up{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-toggle-up:before{content:"\f151"}.fa.fa-caret-square-o-right{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-caret-square-o-right:before{content:"\f152"}.fa.fa-toggle-right{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-toggle-right:before{content:"\f152"}.fa.fa-eur:before,.fa.fa-euro:before{content:"\f153"}.fa.fa-gbp:before{content:"\f154"}.fa.fa-dollar:before,.fa.fa-usd:before{content:"\f155"}.fa.fa-inr:before,.fa.fa-rupee:before{content:"\f156"}.fa.fa-cny:before,.fa.fa-jpy:before,.fa.fa-rmb:before,.fa.fa-yen:before{content:"\f157"}.fa.fa-rouble:before,.fa.fa-rub:before,.fa.fa-ruble:before{content:"\f158"}.fa.fa-krw:before,.fa.fa-won:before{content:"\f159"}.fa.fa-bitcoin,.fa.fa-btc{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-bitcoin:before{content:"\f15a"}.fa.fa-file-text:before{content:"\f15c"}.fa.fa-sort-alpha-asc:before{content:"\f15d"}.fa.fa-sort-alpha-desc:before{content:"\f15e"}.fa.fa-sort-amount-asc:before{content:"\f160"}.fa.fa-sort-amount-desc:before{content:"\f161"}.fa.fa-sort-numeric-asc:before{content:"\f162"}.fa.fa-sort-numeric-desc:before{content:"\f163"}.fa.fa-xing,.fa.fa-xing-square,.fa.fa-youtube,.fa.fa-youtube-play,.fa.fa-youtube-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-youtube-play:before{content:"\f167"}.fa.fa-adn,.fa.fa-bitbucket,.fa.fa-bitbucket-square,.fa.fa-dropbox,.fa.fa-flickr,.fa.fa-instagram,.fa.fa-stack-overflow{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-bitbucket-square:before{content:"\f171"}.fa.fa-tumblr,.fa.fa-tumblr-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-long-arrow-down:before{content:"\f309"}.fa.fa-long-arrow-up:before{content:"\f30c"}.fa.fa-long-arrow-left:before{content:"\f30a"}.fa.fa-long-arrow-right:before{content:"\f30b"}.fa.fa-android,.fa.fa-apple,.fa.fa-dribbble,.fa.fa-foursquare,.fa.fa-gittip,.fa.fa-gratipay,.fa.fa-linux,.fa.fa-skype,.fa.fa-trello,.fa.fa-windows{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-gittip:before{content:"\f184"}.fa.fa-sun-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-sun-o:before{content:"\f185"}.fa.fa-moon-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-moon-o:before{content:"\f186"}.fa.fa-pagelines,.fa.fa-renren,.fa.fa-stack-exchange,.fa.fa-vk,.fa.fa-weibo{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-arrow-circle-o-right{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-arrow-circle-o-right:before{content:"\f35a"}.fa.fa-arrow-circle-o-left{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-arrow-circle-o-left:before{content:"\f359"}.fa.fa-caret-square-o-left{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-caret-square-o-left:before{content:"\f191"}.fa.fa-toggle-left{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-toggle-left:before{content:"\f191"}.fa.fa-dot-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-dot-circle-o:before{content:"\f192"}.fa.fa-vimeo-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-try:before,.fa.fa-turkish-lira:before{content:"\f195"}.fa.fa-plus-square-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-plus-square-o:before{content:"\f0fe"}.fa.fa-openid,.fa.fa-slack,.fa.fa-wordpress{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-bank:before,.fa.fa-institution:before{content:"\f19c"}.fa.fa-mortar-board:before{content:"\f19d"}.fa.fa-delicious,.fa.fa-digg,.fa.fa-drupal,.fa.fa-google,.fa.fa-joomla,.fa.fa-pied-piper-alt,.fa.fa-pied-piper-pp,.fa.fa-reddit,.fa.fa-reddit-square,.fa.fa-stumbleupon,.fa.fa-stumbleupon-circle,.fa.fa-yahoo{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-spoon:before{content:"\f2e5"}.fa.fa-behance,.fa.fa-behance-square,.fa.fa-steam,.fa.fa-steam-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-automobile:before{content:"\f1b9"}.fa.fa-cab:before{content:"\f1ba"}.fa.fa-envelope-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-envelope-o:before{content:"\f0e0"}.fa.fa-deviantart,.fa.fa-soundcloud{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-file-pdf-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-pdf-o:before{content:"\f1c1"}.fa.fa-file-word-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-word-o:before{content:"\f1c2"}.fa.fa-file-excel-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-excel-o:before{content:"\f1c3"}.fa.fa-file-powerpoint-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-powerpoint-o:before{content:"\f1c4"}.fa.fa-file-image-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-image-o:before{content:"\f1c5"}.fa.fa-file-photo-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-photo-o:before{content:"\f1c5"}.fa.fa-file-picture-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-picture-o:before{content:"\f1c5"}.fa.fa-file-archive-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-archive-o:before{content:"\f1c6"}.fa.fa-file-zip-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-zip-o:before{content:"\f1c6"}.fa.fa-file-audio-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-audio-o:before{content:"\f1c7"}.fa.fa-file-sound-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-sound-o:before{content:"\f1c7"}.fa.fa-file-video-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-video-o:before{content:"\f1c8"}.fa.fa-file-movie-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-movie-o:before{content:"\f1c8"}.fa.fa-file-code-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-file-code-o:before{content:"\f1c9"}.fa.fa-codepen,.fa.fa-jsfiddle,.fa.fa-vine{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-life-bouy,.fa.fa-life-ring{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-life-bouy:before{content:"\f1cd"}.fa.fa-life-buoy{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-life-buoy:before{content:"\f1cd"}.fa.fa-life-saver{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-life-saver:before{content:"\f1cd"}.fa.fa-support{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-support:before{content:"\f1cd"}.fa.fa-circle-o-notch:before{content:"\f1ce"}.fa.fa-ra,.fa.fa-rebel{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-ra:before{content:"\f1d0"}.fa.fa-resistance{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-resistance:before{content:"\f1d0"}.fa.fa-empire,.fa.fa-ge{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-ge:before{content:"\f1d1"}.fa.fa-git,.fa.fa-git-square,.fa.fa-hacker-news,.fa.fa-y-combinator-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-y-combinator-square:before{content:"\f1d4"}.fa.fa-yc-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-yc-square:before{content:"\f1d4"}.fa.fa-qq,.fa.fa-tencent-weibo,.fa.fa-wechat,.fa.fa-weixin{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-wechat:before{content:"\f1d7"}.fa.fa-send:before{content:"\f1d8"}.fa.fa-paper-plane-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-paper-plane-o:before{content:"\f1d8"}.fa.fa-send-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-send-o:before{content:"\f1d8"}.fa.fa-circle-thin{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-circle-thin:before{content:"\f111"}.fa.fa-header:before{content:"\f1dc"}.fa.fa-sliders:before{content:"\f1de"}.fa.fa-futbol-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-futbol-o:before{content:"\f1e3"}.fa.fa-soccer-ball-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-soccer-ball-o:before{content:"\f1e3"}.fa.fa-slideshare,.fa.fa-twitch,.fa.fa-yelp{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-newspaper-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-newspaper-o:before{content:"\f1ea"}.fa.fa-cc-amex,.fa.fa-cc-discover,.fa.fa-cc-mastercard,.fa.fa-cc-paypal,.fa.fa-cc-stripe,.fa.fa-cc-visa,.fa.fa-google-wallet,.fa.fa-paypal{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-bell-slash-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-bell-slash-o:before{content:"\f1f6"}.fa.fa-trash:before{content:"\f2ed"}.fa.fa-copyright{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-eyedropper:before{content:"\f1fb"}.fa.fa-area-chart:before{content:"\f1fe"}.fa.fa-pie-chart:before{content:"\f200"}.fa.fa-line-chart:before{content:"\f201"}.fa.fa-angellist,.fa.fa-ioxhost,.fa.fa-lastfm,.fa.fa-lastfm-square{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-cc{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-cc:before{content:"\f20a"}.fa.fa-ils:before,.fa.fa-shekel:before,.fa.fa-sheqel:before{content:"\f20b"}.fa.fa-meanpath{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-meanpath:before{content:"\f2b4"}.fa.fa-buysellads,.fa.fa-connectdevelop,.fa.fa-dashcube,.fa.fa-forumbee,.fa.fa-leanpub,.fa.fa-sellsy,.fa.fa-shirtsinbulk,.fa.fa-simplybuilt,.fa.fa-skyatlas{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-diamond{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-diamond:before{content:"\f3a5"}.fa.fa-intersex:before{content:"\f224"}.fa.fa-facebook-official{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-facebook-official:before{content:"\f09a"}.fa.fa-pinterest-p,.fa.fa-whatsapp{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-hotel:before{content:"\f236"}.fa.fa-medium,.fa.fa-viacoin,.fa.fa-y-combinator,.fa.fa-yc{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-yc:before{content:"\f23b"}.fa.fa-expeditedssl,.fa.fa-opencart,.fa.fa-optin-monster{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-battery-4:before,.fa.fa-battery:before{content:"\f240"}.fa.fa-battery-3:before{content:"\f241"}.fa.fa-battery-2:before{content:"\f242"}.fa.fa-battery-1:before{content:"\f243"}.fa.fa-battery-0:before{content:"\f244"}.fa.fa-object-group,.fa.fa-object-ungroup,.fa.fa-sticky-note-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-sticky-note-o:before{content:"\f249"}.fa.fa-cc-diners-club,.fa.fa-cc-jcb{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-clone,.fa.fa-hourglass-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hourglass-o:before{content:"\f254"}.fa.fa-hourglass-1:before{content:"\f251"}.fa.fa-hourglass-2:before{content:"\f252"}.fa.fa-hourglass-3:before{content:"\f253"}.fa.fa-hand-rock-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-rock-o:before{content:"\f255"}.fa.fa-hand-grab-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-grab-o:before{content:"\f255"}.fa.fa-hand-paper-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-paper-o:before{content:"\f256"}.fa.fa-hand-stop-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-stop-o:before{content:"\f256"}.fa.fa-hand-scissors-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-scissors-o:before{content:"\f257"}.fa.fa-hand-lizard-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-lizard-o:before{content:"\f258"}.fa.fa-hand-spock-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-spock-o:before{content:"\f259"}.fa.fa-hand-pointer-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-pointer-o:before{content:"\f25a"}.fa.fa-hand-peace-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-hand-peace-o:before{content:"\f25b"}.fa.fa-registered{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-chrome,.fa.fa-creative-commons,.fa.fa-firefox,.fa.fa-get-pocket,.fa.fa-gg,.fa.fa-gg-circle,.fa.fa-internet-explorer,.fa.fa-odnoklassniki,.fa.fa-odnoklassniki-square,.fa.fa-opera,.fa.fa-safari,.fa.fa-tripadvisor,.fa.fa-wikipedia-w{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-television:before{content:"\f26c"}.fa.fa-500px,.fa.fa-amazon,.fa.fa-contao{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-calendar-plus-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-calendar-plus-o:before{content:"\f271"}.fa.fa-calendar-minus-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-calendar-minus-o:before{content:"\f272"}.fa.fa-calendar-times-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-calendar-times-o:before{content:"\f273"}.fa.fa-calendar-check-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-calendar-check-o:before{content:"\f274"}.fa.fa-map-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-map-o:before{content:"\f279"}.fa.fa-commenting:before{content:"\f4ad"}.fa.fa-commenting-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-commenting-o:before{content:"\f4ad"}.fa.fa-houzz,.fa.fa-vimeo{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-vimeo:before{content:"\f27d"}.fa.fa-black-tie,.fa.fa-edge,.fa.fa-fonticons,.fa.fa-reddit-alien{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-credit-card-alt:before{content:"\f09d"}.fa.fa-codiepie,.fa.fa-fort-awesome,.fa.fa-mixcloud,.fa.fa-modx,.fa.fa-product-hunt,.fa.fa-scribd,.fa.fa-usb{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-pause-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-pause-circle-o:before{content:"\f28b"}.fa.fa-stop-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-stop-circle-o:before{content:"\f28d"}.fa.fa-bluetooth,.fa.fa-bluetooth-b,.fa.fa-envira,.fa.fa-gitlab,.fa.fa-wheelchair-alt,.fa.fa-wpbeginner,.fa.fa-wpforms{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-wheelchair-alt:before{content:"\f368"}.fa.fa-question-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-question-circle-o:before{content:"\f059"}.fa.fa-volume-control-phone:before{content:"\f2a0"}.fa.fa-asl-interpreting:before{content:"\f2a3"}.fa.fa-deafness:before,.fa.fa-hard-of-hearing:before{content:"\f2a4"}.fa.fa-glide,.fa.fa-glide-g{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-signing:before{content:"\f2a7"}.fa.fa-first-order,.fa.fa-google-plus-official,.fa.fa-pied-piper,.fa.fa-snapchat,.fa.fa-snapchat-ghost,.fa.fa-snapchat-square,.fa.fa-themeisle,.fa.fa-viadeo,.fa.fa-viadeo-square,.fa.fa-yoast{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-google-plus-official:before{content:"\f2b3"}.fa.fa-google-plus-circle{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-google-plus-circle:before{content:"\f2b3"}.fa.fa-fa,.fa.fa-font-awesome{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-fa:before{content:"\f2b4"}.fa.fa-handshake-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-handshake-o:before{content:"\f2b5"}.fa.fa-envelope-open-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-envelope-open-o:before{content:"\f2b6"}.fa.fa-linode{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-address-book-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-address-book-o:before{content:"\f2b9"}.fa.fa-vcard:before{content:"\f2bb"}.fa.fa-address-card-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-address-card-o:before{content:"\f2bb"}.fa.fa-vcard-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-vcard-o:before{content:"\f2bb"}.fa.fa-user-circle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-user-circle-o:before{content:"\f2bd"}.fa.fa-user-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-user-o:before{content:"\f007"}.fa.fa-id-badge{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-drivers-license:before{content:"\f2c2"}.fa.fa-id-card-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-id-card-o:before{content:"\f2c2"}.fa.fa-drivers-license-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-drivers-license-o:before{content:"\f2c2"}.fa.fa-free-code-camp,.fa.fa-quora,.fa.fa-telegram{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-thermometer-4:before,.fa.fa-thermometer:before{content:"\f2c7"}.fa.fa-thermometer-3:before{content:"\f2c8"}.fa.fa-thermometer-2:before{content:"\f2c9"}.fa.fa-thermometer-1:before{content:"\f2ca"}.fa.fa-thermometer-0:before{content:"\f2cb"}.fa.fa-bathtub:before,.fa.fa-s15:before{content:"\f2cd"}.fa.fa-window-maximize,.fa.fa-window-restore{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-times-rectangle:before{content:"\f410"}.fa.fa-window-close-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-window-close-o:before{content:"\f410"}.fa.fa-times-rectangle-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-times-rectangle-o:before{content:"\f410"}.fa.fa-bandcamp,.fa.fa-eercast,.fa.fa-etsy,.fa.fa-grav,.fa.fa-imdb,.fa.fa-ravelry{font-family:"Font Awesome 5 Brands";font-weight:400}.fa.fa-eercast:before{content:"\f2da"}.fa.fa-snowflake-o{font-family:"Font Awesome 5 Free";font-weight:400}.fa.fa-snowflake-o:before{content:"\f2dc"}.fa.fa-spotify,.fa.fa-superpowers,.fa.fa-wpexplorer{font-family:"Font Awesome 5 Brands";font-weight:400} diff --git a/src/main/resources/font-awesome/webfonts/fa-brands-400.eot b/src/main/resources/font-awesome/webfonts/fa-brands-400.eot new file mode 100644 index 000000000000..02a5ecb98ccc Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-brands-400.eot differ diff --git a/src/main/resources/font-awesome/webfonts/fa-brands-400.svg b/src/main/resources/font-awesome/webfonts/fa-brands-400.svg new file mode 100644 index 000000000000..1b168ee9520f --- /dev/null +++ b/src/main/resources/font-awesome/webfonts/fa-brands-400.svg @@ -0,0 +1,3459 @@ + + + + + +Created by FontForge 20190112 at Thu Mar 21 16:19:01 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/font-awesome/webfonts/fa-brands-400.ttf b/src/main/resources/font-awesome/webfonts/fa-brands-400.ttf new file mode 100644 index 000000000000..3926cb172804 Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-brands-400.ttf differ diff --git a/src/main/resources/font-awesome/webfonts/fa-brands-400.woff b/src/main/resources/font-awesome/webfonts/fa-brands-400.woff new file mode 100644 index 000000000000..7bcc97eaeb7e Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-brands-400.woff differ diff --git a/src/main/resources/font-awesome/webfonts/fa-brands-400.woff2 b/src/main/resources/font-awesome/webfonts/fa-brands-400.woff2 new file mode 100644 index 000000000000..2abc94a5990a Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-brands-400.woff2 differ diff --git a/src/main/resources/font-awesome/webfonts/fa-regular-400.eot b/src/main/resources/font-awesome/webfonts/fa-regular-400.eot new file mode 100644 index 000000000000..7b7a1d707379 Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-regular-400.eot differ diff --git a/src/main/resources/font-awesome/webfonts/fa-regular-400.svg b/src/main/resources/font-awesome/webfonts/fa-regular-400.svg new file mode 100644 index 000000000000..80cf2b2936b3 --- /dev/null +++ b/src/main/resources/font-awesome/webfonts/fa-regular-400.svg @@ -0,0 +1,803 @@ + + + + + +Created by FontForge 20190112 at Thu Mar 21 16:19:01 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/font-awesome/webfonts/fa-regular-400.ttf b/src/main/resources/font-awesome/webfonts/fa-regular-400.ttf new file mode 100644 index 000000000000..17b86c2f0a22 Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-regular-400.ttf differ diff --git a/src/main/resources/font-awesome/webfonts/fa-regular-400.woff b/src/main/resources/font-awesome/webfonts/fa-regular-400.woff new file mode 100644 index 000000000000..822243e2702d Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-regular-400.woff differ diff --git a/src/main/resources/font-awesome/webfonts/fa-regular-400.woff2 b/src/main/resources/font-awesome/webfonts/fa-regular-400.woff2 new file mode 100644 index 000000000000..c446ff7aecd6 Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-regular-400.woff2 differ diff --git a/src/main/resources/font-awesome/webfonts/fa-solid-900.eot b/src/main/resources/font-awesome/webfonts/fa-solid-900.eot new file mode 100644 index 000000000000..dfc8921a364c Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-solid-900.eot differ diff --git a/src/main/resources/font-awesome/webfonts/fa-solid-900.svg b/src/main/resources/font-awesome/webfonts/fa-solid-900.svg new file mode 100644 index 000000000000..132373b3ef67 --- /dev/null +++ b/src/main/resources/font-awesome/webfonts/fa-solid-900.svg @@ -0,0 +1,4527 @@ + + + + + +Created by FontForge 20190112 at Thu Mar 21 16:19:01 2019 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/font-awesome/webfonts/fa-solid-900.ttf b/src/main/resources/font-awesome/webfonts/fa-solid-900.ttf new file mode 100644 index 000000000000..97ae69b91737 Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-solid-900.ttf differ diff --git a/src/main/resources/font-awesome/webfonts/fa-solid-900.woff b/src/main/resources/font-awesome/webfonts/fa-solid-900.woff new file mode 100644 index 000000000000..86d9b32bae2f Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-solid-900.woff differ diff --git a/src/main/resources/font-awesome/webfonts/fa-solid-900.woff2 b/src/main/resources/font-awesome/webfonts/fa-solid-900.woff2 new file mode 100644 index 000000000000..67f67dc1650e Binary files /dev/null and b/src/main/resources/font-awesome/webfonts/fa-solid-900.woff2 differ diff --git a/src/main/resources/images/health_hub_32.png b/src/main/resources/images/health_hub_32.png new file mode 100644 index 000000000000..3e5939915caf Binary files /dev/null and b/src/main/resources/images/health_hub_32.png differ diff --git a/src/main/resources/images/health_worker.png b/src/main/resources/images/health_worker.png new file mode 100644 index 000000000000..fb9e6f3a69d1 Binary files /dev/null and b/src/main/resources/images/health_worker.png differ diff --git a/src/main/resources/images/patient.png b/src/main/resources/images/patient.png new file mode 100644 index 000000000000..7b3db7477ae0 Binary files /dev/null and b/src/main/resources/images/patient.png differ diff --git a/src/main/resources/view/CommandBox.fxml b/src/main/resources/view/CommandBox.fxml index 70bd59ab3215..4c8c909f9765 100644 --- a/src/main/resources/view/CommandBox.fxml +++ b/src/main/resources/view/CommandBox.fxml @@ -1,9 +1,10 @@ - + - - + + diff --git a/src/main/resources/view/DarkTheme.css b/src/main/resources/view/DarkTheme.css deleted file mode 100644 index 36e6b001cd8d..000000000000 --- a/src/main/resources/view/DarkTheme.css +++ /dev/null @@ -1,352 +0,0 @@ -.background { - -fx-background-color: derive(#1d1d1d, 20%); - background-color: #383838; /* Used in the default.html file */ -} - -.label { - -fx-font-size: 11pt; - -fx-font-family: "Segoe UI Semibold"; - -fx-text-fill: #555555; - -fx-opacity: 0.9; -} - -.label-bright { - -fx-font-size: 11pt; - -fx-font-family: "Segoe UI Semibold"; - -fx-text-fill: white; - -fx-opacity: 1; -} - -.label-header { - -fx-font-size: 32pt; - -fx-font-family: "Segoe UI Light"; - -fx-text-fill: white; - -fx-opacity: 1; -} - -.text-field { - -fx-font-size: 12pt; - -fx-font-family: "Segoe UI Semibold"; -} - -.tab-pane { - -fx-padding: 0 0 0 1; -} - -.tab-pane .tab-header-area { - -fx-padding: 0 0 0 0; - -fx-min-height: 0; - -fx-max-height: 0; -} - -.table-view { - -fx-base: #1d1d1d; - -fx-control-inner-background: #1d1d1d; - -fx-background-color: #1d1d1d; - -fx-table-cell-border-color: transparent; - -fx-table-header-border-color: transparent; - -fx-padding: 5; -} - -.table-view .column-header-background { - -fx-background-color: transparent; -} - -.table-view .column-header, .table-view .filler { - -fx-size: 35; - -fx-border-width: 0 0 1 0; - -fx-background-color: transparent; - -fx-border-color: - transparent - transparent - derive(-fx-base, 80%) - transparent; - -fx-border-insets: 0 10 1 0; -} - -.table-view .column-header .label { - -fx-font-size: 20pt; - -fx-font-family: "Segoe UI Light"; - -fx-text-fill: white; - -fx-alignment: center-left; - -fx-opacity: 1; -} - -.table-view:focused .table-row-cell:filled:focused:selected { - -fx-background-color: -fx-focus-color; -} - -.split-pane:horizontal .split-pane-divider { - -fx-background-color: derive(#1d1d1d, 20%); - -fx-border-color: transparent transparent transparent #4d4d4d; -} - -.split-pane { - -fx-border-radius: 1; - -fx-border-width: 1; - -fx-background-color: derive(#1d1d1d, 20%); -} - -.list-view { - -fx-background-insets: 0; - -fx-padding: 0; - -fx-background-color: derive(#1d1d1d, 20%); -} - -.list-cell { - -fx-label-padding: 0 0 0 0; - -fx-graphic-text-gap : 0; - -fx-padding: 0 0 0 0; -} - -.list-cell:filled:even { - -fx-background-color: #3c3e3f; -} - -.list-cell:filled:odd { - -fx-background-color: #515658; -} - -.list-cell:filled:selected { - -fx-background-color: #424d5f; -} - -.list-cell:filled:selected #cardPane { - -fx-border-color: #3e7b91; - -fx-border-width: 1; -} - -.list-cell .label { - -fx-text-fill: white; -} - -.cell_big_label { - -fx-font-family: "Segoe UI Semibold"; - -fx-font-size: 16px; - -fx-text-fill: #010504; -} - -.cell_small_label { - -fx-font-family: "Segoe UI"; - -fx-font-size: 13px; - -fx-text-fill: #010504; -} - -.stack-pane { - -fx-background-color: derive(#1d1d1d, 20%); -} - -.pane-with-border { - -fx-background-color: derive(#1d1d1d, 20%); - -fx-border-color: derive(#1d1d1d, 10%); - -fx-border-top-width: 1px; -} - -.status-bar { - -fx-background-color: derive(#1d1d1d, 30%); -} - -.result-display { - -fx-background-color: transparent; - -fx-font-family: "Segoe UI Light"; - -fx-font-size: 13pt; - -fx-text-fill: white; -} - -.result-display .label { - -fx-text-fill: black !important; -} - -.status-bar .label { - -fx-font-family: "Segoe UI Light"; - -fx-text-fill: white; - -fx-padding: 4px; - -fx-pref-height: 30px; -} - -.status-bar-with-border { - -fx-background-color: derive(#1d1d1d, 30%); - -fx-border-color: derive(#1d1d1d, 25%); - -fx-border-width: 1px; -} - -.status-bar-with-border .label { - -fx-text-fill: white; -} - -.grid-pane { - -fx-background-color: derive(#1d1d1d, 30%); - -fx-border-color: derive(#1d1d1d, 30%); - -fx-border-width: 1px; -} - -.grid-pane .stack-pane { - -fx-background-color: derive(#1d1d1d, 30%); -} - -.context-menu { - -fx-background-color: derive(#1d1d1d, 50%); -} - -.context-menu .label { - -fx-text-fill: white; -} - -.menu-bar { - -fx-background-color: derive(#1d1d1d, 20%); -} - -.menu-bar .label { - -fx-font-size: 14pt; - -fx-font-family: "Segoe UI Light"; - -fx-text-fill: white; - -fx-opacity: 0.9; -} - -.menu .left-container { - -fx-background-color: black; -} - -/* - * Metro style Push Button - * Author: Pedro Duque Vieira - * http://pixelduke.wordpress.com/2012/10/23/jmetro-windows-8-controls-on-java/ - */ -.button { - -fx-padding: 5 22 5 22; - -fx-border-color: #e2e2e2; - -fx-border-width: 2; - -fx-background-radius: 0; - -fx-background-color: #1d1d1d; - -fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif; - -fx-font-size: 11pt; - -fx-text-fill: #d8d8d8; - -fx-background-insets: 0 0 0 0, 0, 1, 2; -} - -.button:hover { - -fx-background-color: #3a3a3a; -} - -.button:pressed, .button:default:hover:pressed { - -fx-background-color: white; - -fx-text-fill: #1d1d1d; -} - -.button:focused { - -fx-border-color: white, white; - -fx-border-width: 1, 1; - -fx-border-style: solid, segments(1, 1); - -fx-border-radius: 0, 0; - -fx-border-insets: 1 1 1 1, 0; -} - -.button:disabled, .button:default:disabled { - -fx-opacity: 0.4; - -fx-background-color: #1d1d1d; - -fx-text-fill: white; -} - -.button:default { - -fx-background-color: -fx-focus-color; - -fx-text-fill: #ffffff; -} - -.button:default:hover { - -fx-background-color: derive(-fx-focus-color, 30%); -} - -.dialog-pane { - -fx-background-color: #1d1d1d; -} - -.dialog-pane > *.button-bar > *.container { - -fx-background-color: #1d1d1d; -} - -.dialog-pane > *.label.content { - -fx-font-size: 14px; - -fx-font-weight: bold; - -fx-text-fill: white; -} - -.dialog-pane:header *.header-panel { - -fx-background-color: derive(#1d1d1d, 25%); -} - -.dialog-pane:header *.header-panel *.label { - -fx-font-size: 18px; - -fx-font-style: italic; - -fx-fill: white; - -fx-text-fill: white; -} - -.scroll-bar { - -fx-background-color: derive(#1d1d1d, 20%); -} - -.scroll-bar .thumb { - -fx-background-color: derive(#1d1d1d, 50%); - -fx-background-insets: 3; -} - -.scroll-bar .increment-button, .scroll-bar .decrement-button { - -fx-background-color: transparent; - -fx-padding: 0 0 0 0; -} - -.scroll-bar .increment-arrow, .scroll-bar .decrement-arrow { - -fx-shape: " "; -} - -.scroll-bar:vertical .increment-arrow, .scroll-bar:vertical .decrement-arrow { - -fx-padding: 1 8 1 8; -} - -.scroll-bar:horizontal .increment-arrow, .scroll-bar:horizontal .decrement-arrow { - -fx-padding: 8 1 8 1; -} - -#cardPane { - -fx-background-color: transparent; - -fx-border-width: 0; -} - -#commandTypeLabel { - -fx-font-size: 11px; - -fx-text-fill: #F70D1A; -} - -#commandTextField { - -fx-background-color: transparent #383838 transparent #383838; - -fx-background-insets: 0; - -fx-border-color: #383838 #383838 #ffffff #383838; - -fx-border-insets: 0; - -fx-border-width: 1; - -fx-font-family: "Segoe UI Light"; - -fx-font-size: 13pt; - -fx-text-fill: white; -} - -#filterField, #personListPanel, #personWebpage { - -fx-effect: innershadow(gaussian, black, 10, 0, 0, 0); -} - -#resultDisplay .content { - -fx-background-color: transparent, #383838, transparent, #383838; - -fx-background-radius: 0; -} - -#tags { - -fx-hgap: 7; - -fx-vgap: 3; -} - -#tags .label { - -fx-text-fill: white; - -fx-background-color: #3e7b91; - -fx-padding: 1 3 1 3; - -fx-border-radius: 2; - -fx-background-radius: 2; - -fx-font-size: 11; -} diff --git a/src/main/resources/view/Extensions.css b/src/main/resources/view/Extensions.css index bfe82a85964d..abb687197fa9 100644 --- a/src/main/resources/view/Extensions.css +++ b/src/main/resources/view/Extensions.css @@ -5,7 +5,7 @@ .list-cell:empty { /* Empty cells will not have alternating colours */ - -fx-background: #383838; + -fx-background: white; } .tag-selector { diff --git a/src/main/resources/view/HealthWorkerListCard.fxml b/src/main/resources/view/HealthWorkerListCard.fxml new file mode 100644 index 000000000000..0ab9dc9809f1 --- /dev/null +++ b/src/main/resources/view/HealthWorkerListCard.fxml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ diff --git a/src/main/resources/view/HealthWorkerListPanel.fxml b/src/main/resources/view/HealthWorkerListPanel.fxml new file mode 100644 index 000000000000..67c3b02e7a03 --- /dev/null +++ b/src/main/resources/view/HealthWorkerListPanel.fxml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/view/BrowserPanel.fxml b/src/main/resources/view/InfoPanel.fxml similarity index 82% rename from src/main/resources/view/BrowserPanel.fxml rename to src/main/resources/view/InfoPanel.fxml index 31670827e3da..d9b3439c0233 100644 --- a/src/main/resources/view/BrowserPanel.fxml +++ b/src/main/resources/view/InfoPanel.fxml @@ -4,5 +4,5 @@ - + diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 601ddabf2b5e..beaf28070bbb 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -11,58 +11,69 @@ - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + diff --git a/src/main/resources/view/PersonListCard.fxml b/src/main/resources/view/PersonListCard.fxml deleted file mode 100644 index f08ea32ad558..000000000000 --- a/src/main/resources/view/PersonListCard.fxml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/view/RequestListCard.fxml b/src/main/resources/view/RequestListCard.fxml new file mode 100644 index 000000000000..dcae64fc41da --- /dev/null +++ b/src/main/resources/view/RequestListCard.fxml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/view/PersonListPanel.fxml b/src/main/resources/view/RequestListPanel.fxml similarity index 77% rename from src/main/resources/view/PersonListPanel.fxml rename to src/main/resources/view/RequestListPanel.fxml index 8836d323cc5d..5926fc25cbf9 100644 --- a/src/main/resources/view/PersonListPanel.fxml +++ b/src/main/resources/view/RequestListPanel.fxml @@ -4,5 +4,5 @@ - + diff --git a/src/main/resources/view/ResultDisplay.fxml b/src/main/resources/view/ResultDisplay.fxml index 58d5ad3dc56c..891cbd22e08e 100644 --- a/src/main/resources/view/ResultDisplay.fxml +++ b/src/main/resources/view/ResultDisplay.fxml @@ -3,7 +3,6 @@ - -