in _stake() function you used ERC721 approve function and , it gave error "ERC721: approve caller is not token owner nor approved for all".
Which is very obvious as for NFT contract msg.sender is Staking contract not the user and
see approve function of ERC721
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner nor approved for all"
);
_approve(to, tokenId);
}
in _stake() function you used ERC721 approve function and , it gave error "ERC721: approve caller is not token owner nor approved for all".
Which is very obvious as for NFT contract msg.sender is Staking contract not the user and
see approve function of ERC721