Firstly, you need to implement approve button in the UI, when user clicks it, approval should be called like this:
IERC20(_tokenAddress).approve(ADDRESS_OF_YOUR_DAPP, amount)
Where _tokenAddress is an address which we can get from the input field in the UI (for example, user can choose token to deposit in some dropdown menu) and _amount is a value that we can also get from the UI.
Then, when approval is done, when a user clicks on some Deposit button, you should execute your deposit function from your smart-contract, inside which transferFrom should be implemented like this:
IERC20(_tokenAddress).transferFrom(msg.sender, address(this), _amount)
Secondly, don't fully get your idea of
allows the contract admin to transfer the token when the function
transferfrom() is called
If you need to transfer this tokens from dapp contract to admin contract, you can do just:
IERC20(_tokenAddress).transfer(ADDRESS_OF_ADMIN, _amount)
Or if you need to allow to admin contract to transfer tokens from dapp contract, you need to call approve inside dapp contract itself:
IERC20(_tokenAddress).approve(ADDRESS_OF_ADMIN, _amount)
And then if you want, you can call transferFrom inside the admin contract to transfer tokens from dapp contract.