[TASK] ADWD-1465 Confirm discarding unsaved changes

- Only enable save button if there are unsaved changes
- Create save button after page render, remove from templates
- Small code cleanups