This repository is for printing forms in bahmni so that they can be filled offline. Currently it supports only forms 1.0(means forms under 'All Observation templates, not form builder forms).
This is completely written in angular-6
brew install npm
brew install http-server
(Install http-server for checking test coverage)
Clone the repository in bahmni folder by running following command.
git clone https://github.com/bahmni-msf/print-forms.git
Install all the dependencies by running following commands.
cd print-forms && npm install -g @angular/cli && npm install && npm run build
Run the following script inside your bahmni-vagrant-box and provide your mysql database password .
sh /bahmni/print-forms/scripts/create_privilege.sh
Run following script inside your bahmni-vagrant-box.
sudo sh /bahmni/print-forms/scripts/dev-setup.sh
Add following config in bahmni_config/openmrs/apps/home/extension.json
file to display print icon on dashboard.
"PrintForms": { "id": "bahmni.print.forms", "extensionPointId": "org.bahmni.home.dashboard", "type": "link", "label": "Print Forms", "url": "/print-forms", "icon": "fa fa-print", "order": 12, "requiredPrivilege": "app:print-forms" }
- Make sure the logged-in user has the privileges Get Concepts and app:print-forms.
- Optional:
- It is recommended to create a role Print-Forms-App and inherit the role Bahmni-App-User-Login and assign above two privileges to Print-Forms-App
- Add the role Print-Forms-App to the logged-in user.
After giving privilege to the logged-in user logout from bahmni and again login, now you will be able to see print-forms icon on the on the bahmni-home page.
Run npm run build
for building the project.
Run ng test
to execute the unit tests via Karma.
Run ng test
for running the test.
Run http-server -c-1 -o -p 9875 ./coverage
to check coverage in your browser.
Run following command tho fix eslint erros.
ng lint print-forms --fix
yum install wget
-
Run following command inside your bahmni-vagrant-box.
wget -O ./deploy.sh https://raw.githubusercontent.com/bahmni-msf/print-forms/master/scripts/deploy-print-forms.sh
sh ./deploy.sh && rm ./deploy.sh
-
Create a print-forms privilege in openmrs database.
(Run following command inside your bahmni-vagrant-box and provide mysql database password )
mysql -uroot -p openmrs -Bse "INSERT IGNORE INTO privilege VALUES ('app:print-forms', 'Will give access to print forms app', UUID());"
-
Add following config in
/var/www/bahmni_config/openmrs/apps/home/extension.json
file.
"PrintForms": { "id": "bahmni.print.forms", "extensionPointId": "org.bahmni.home.dashboard", "type": "link", "label": "Print Forms", "url": "/print-forms", "icon": "fa fa-print", "order": 12, "requiredPrivilege": "app:print-forms" }
- Make sure the logged-in user has the privileges Get Concepts and app:print-forms.
- Optional:
- It is recommended to create a role Print-Forms-App and inherit the role Bahmni-App-User-Login and assign above two privileges to Print-Forms-App
- Add the role Print-Forms-App to the logged-in user.
After giving privilege to the logged-in user logout from bahmni and again login, now you will be able to see print-forms icon on the on the bahmni-home page.