I understand your Mac is only powering on when connected to a charger. I'd like to look into this with you.
First, let's check the battery cycle count for your computer. This can help determine the life of your battery and its health: Let us know the result! Also, have you tried resetting the SMC? Here's how: