Israel's cabinet has approved a ceasefire deal with Hamas, paving the way for hostages and Palestinian prisoners to be released within the next 24 hours.