refactoring availability js
finished refactoring avail tab