|
| 1 | +<img src="https://www.creditas.com.br/static/images/logo-creditas-color-8367919c2a.svg" width="400"> |
| 2 | + |
| 3 | +# Frontend Challenge - Creditas |
| 4 | + |
| 5 | +This is a challenge designed to measure the candidate's expertise. |
| 6 | +We would like to clarify that we don't expect everyone to be able to finish the whole challenge, since it has been designed to cover the several degrees of expertise, from junior to senior. |
| 7 | +Nevertheless, we expect anyone interested in becoming a tripulante in Creditas to give it a try. |
| 8 | + |
| 9 | +In this challenge, we focus both on code design and design patterns in JavaScript. The goal is to assess your experience in writing **code that is easy to maintain, loosely coupled and highly cohesive**. |
| 10 | + |
| 11 | +At Creditas we always work giving constructive feedback, therefore we will always dedicate the outmost attention to every solution submitted; contacting you back with the positive aspects of your submission and what could be improved. Just for that it is worth trying! :) |
| 12 | + |
| 13 | +## The challenge |
| 14 | + |
| 15 | +You have to improve the loan simulation calculator implemented in this project. |
| 16 | + |
| 17 | +Both the interface as well as the styles are provided. The challenges include refactoring the code and implemetning new functionalities (listed below). |
| 18 | + |
| 19 | +Feel free to componentize whatever you think should be componentized. Our only request is that you use only pure JavaScript, our beloved Vanilla. Do you accept the challenge? |
| 20 | + |
| 21 | +The calculator's current state: |
| 22 | +<img style="display: block; margin: 0 auto;" src="./layout.png"> |
| 23 | + |
| 24 | + |
| 25 | +### Expected functionalities |
| 26 | + |
| 27 | +The application must allow the user to choose the collateral type they want to use in their equity loan simulation: |
| 28 | +***"Auto"*** or ***"Home"*** (the default option is ***"Auto"*** ). |
| 29 | + |
| 30 | +It should also follow the calculation rules bellow: |
| 31 | + |
| 32 | +**Common Rules** |
| 33 | +- Financial Transaction Tax (FTT): 6.38%; |
| 34 | +- Interest Rate: 2.34%; |
| 35 | +- Maximum loan-to-value (amount the user can borrow): 80% of the collateral's value; |
| 36 | + |
| 37 | +*Total Loan Amount Formula* |
| 38 | + |
| 39 | +```javascript |
| 40 | +const totalLoanAmount = ((FTT / 100) + (interestRate / 100) + (termInMonths / 1000) + 1) * loanAmount |
| 41 | +``` |
| 42 | + |
| 43 | +*Monthly payment formula* |
| 44 | + |
| 45 | +```javascript |
| 46 | +const monthlyPayment = totalLoanAmount / termInMonths |
| 47 | +``` |
| 48 | + |
| 49 | +## Challenges to achieve |
| 50 | + |
| 51 | +### CSS |
| 52 | +* **Refactor to make maintainance easier** |
| 53 | + |
| 54 | +Currently, the project's CSS file has too many styles, making readability difficult. We expect you to organize styles, isolating them in order to make them more readable and easier to maintain. |
| 55 | + |
| 56 | +### HTML / JS |
| 57 | +* **Add new collateral type _"Home"_** (with its calculation rules) |
| 58 | +* **Refactor the old code (and arrange the new one) to make maintainance easier** |
| 59 | + |
| 60 | +Currently, Creditas offers two products: home equity loan and auto equity loan. This project implements the *"auto equity"* option only, **you must implement the *"home equity"* option**. |
| 61 | +By changing the collateral type in the `select` element, the user must see the amount and term options corresponding to the product chosen. That is, when selecting either _"Home"_ or _"Auto"_, you must show the correspondent values for each option on the form fields and on the slider. |
| 62 | +Please find the corresponding values below: |
| 63 | + |
| 64 | +**Auto** |
| 65 | +- Minimum loan amount: R$ 3.000,00; |
| 66 | +- Maximum loan amount: R$ 100.000,00; |
| 67 | +- Terms: 24 / 36 / 48 months |
| 68 | +- Minimum guarantee amount: R$ 5.000,00; |
| 69 | +- Maximum guarantee amount: R$ 3.000.000,00; |
| 70 | + |
| 71 | +**Home** |
| 72 | +- Minimum loan amount: R$ 30.000,00; |
| 73 | +- Maximum loan amount: R$ 4.500.000,00; |
| 74 | +- Terms: 120 / 180 / 240 months |
| 75 | +- Minimum guarantee amount: R$ 50.000,00; |
| 76 | +- Maximum guarantee amount: R$ 100.000.000,00; |
| 77 | + |
| 78 | +Finally, you must update the monthly payment value whenever changes in the form's inputs are done. |
| 79 | + |
| 80 | +## Development |
| 81 | + |
| 82 | +### Prerequisites |
| 83 | + |
| 84 | +You will need to install on your machine: |
| 85 | +- [NodeJs](https://nodejs.org/en/) in order to run the application. |
| 86 | +- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) in order to clone the repository containing this challenge and submit the pull request with your solution. |
| 87 | + |
| 88 | +### Configuration to run the environment |
| 89 | + |
| 90 | +By executing the following lines of code in your terminal you will be able to: |
| 91 | +- Clone the repository containing this challenge. |
| 92 | +- Install the necessary dependencies to run the application. |
| 93 | +- Run the application. |
| 94 | + |
| 95 | +```shell |
| 96 | +git clone https://github.com/Creditas/challenge.git |
| 97 | +cd frontend/ |
| 98 | +npm install |
| 99 | +npm start |
| 100 | +``` |
| 101 | + |
| 102 | +If everything is correct, you should be able to access the following URL: [http://localhost:4000/](http://localhost:4000/). |
| 103 | + |
| 104 | +### Dependencies |
| 105 | + |
| 106 | +This project uses some libraries to assist us with tests and running the application. Those are: |
| 107 | +- [https://webpack.js.org/](Webpack) |
| 108 | +- [https://babeljs.io/](Babel) |
| 109 | +- [https://jestjs.io/](Jest) |
| 110 | +- [https://eslint.org/](Eslint) |
| 111 | + |
| 112 | +## Tests |
| 113 | + |
| 114 | +To run the tests you must execute the following command: |
| 115 | + |
| 116 | +```shell |
| 117 | +npm test |
| 118 | +``` |
| 119 | + |
| 120 | +## Feedback (optional) |
| 121 | + |
| 122 | +As we said earlier, here at Creditas constructive feedbacks are part of our culture, so it would be very rewarding if you could contribute with our hiring process by giving us your [https://docs.google.com/forms/d/e/1FAIpQLSdwjudz38JMtMYf3rFBrMHX3XMy2J5oBLPnjBGD1QKvOM2SGg/viewform](opinion) on the challenge. |
| 123 | +We would like you to send it even if you didn't finish the challenge. |
0 commit comments