Field theoretical approach to inhomogeneous ionic systems: thermodynamic consistency with the contact theorem, Gibbs adsorption and surface tension