refactored codes to orders and purchases to allow users to see but not able to edit them