appointment-dialog now saves and cleaned up js code