Global refactor of how modal popups are used + confirmation for synchronous save

Global refactor of how modal popups are used:
- create separate js library with all functions to show/hide/config modals
- move modals templates to separate html file
- make existing modals to use new library and templates

Confirmation for synchronous save is added