Garmin 5x plus switching off randomly

My Garmin 5XPlus also switches off randomly during training and any other time. It stays off and refuses to switch on again and only after numerous attempts does it switch on. The battery is 80% to fully charged when this happens. All training data is lots and sometimes when it switches on, long after the training was complete, it asks whether to continue with the activity or save the activity.

It also battles to charge and only after a while it shows connection to the charger.

please help!