wp_enqueue_script jquery and jquery ui not working

The problem is that your first block of inline datepicker js is before jQuery and jQuery UI.

When you use wp_enqueue_script your script tags will be output where your wp_head() action hook is located. Move your inline datepicer js below wp_head and your jQuery should work.

enter image description here

You should also be using the no conflict wrapper for your inline datepicker js:

jQuery(document).ready(function($) {
    $("datepicker").datepicker({ });