In 1977 , an agreement was signed for the complete transfer of the Canal from the US to Panama by the end of the century .