New Zealand's parliament has voted to ban all types of semi-automatic weapons and assault rifles following the Christchurch attacks.