Plans to transform a derelict building in Chatham into modern flats and a rooftop bar have been approved.