First-principles study of electronic and elastic properties of EuCd and GdCd