Refactored crop management JS code, removed it from the php file and did a bit of optimization inside of it.