The picture does not answer enough question. This may be a completely code compliant installation if:
1) The outlet is GFCI protected
2) Access is provided to the motor if that is a jacuzzi type tub
3) The window is safety glazing
I see nothing wrong if the above 3 items are met.