refactored client side js for edit-truck