Clean up, and preliminary implementation for GCP-9521

Post commit code review : Daniel Jao
Merge branch 'master' of https://github.com/digitalabs/Fieldbook
Clean up of manageTrial.js
Separated the data manager into a separate file
Fix for GCP-9521

Post commit code review : Daniel Jao