You should take a look at the sample app on the AppStore called field service app. It's under the sample apps. It does pretty much everything you explained, apart from detect the gps automatically. The current widget requires you to press the button to get the gps, but it would very straight forward to add some code to the widget to execute it when a page opens.
Also check out this widget:
https://appstore.home.mendix.com/link/app/1380/Mendix/Geolocation-for-PhoneGap
Have a a look at the company expenses demo in the appstore. I think it pretty much covers what you need.
And since I assume this is for a mobile device also take a good look at the documentation regarding Mobile Mendix apps