Refactor JavaScript to use AMD modules for each view

- Refactors JS to use AMD modules for each view