added filter in index, and refactorized code, fixed error view in new appointment