<?php endif; ?>
<a class="fusion-one-page-text-link fusion-page-load-link"></a>
+ <script>
+
+ jQuery(function($) {
+
+ var input = $('#input_8_1').val(),
+ i,
+ el,
+ j,
+ test,
+ arrival,
+ rowA,
+ rowB,
+ clone,
+ date1,
+ table1,
+ table2,
+ date2,
+ golfDate,
+ staticGolfDate,
+ numDays;
+
+ //populate dropdowns for number of golfers first loop is for AM second is for PM
+ $("#field_8_56").find(".add_list_item").attr("id", "rowBtn");
+ $("#field_8_57").find(".add_list_item").attr("id", "rowBtn2");
+
+ $("#field_8_56").find(".delete_list_item").attr("id", "removeRowBtn");
+ $("#field_8_57").find(".delete_list_item").attr("id", "removeRowBtn2");
+ $('.gfield_list_56_cell2').find("[name='input_56[]']").attr("id", 'cell2A');
+ $('.gfield_list_57_cell2').find("[name='input_57[]']").attr("id", 'cell2B');
+ $('.gfield_list_56_cell3').find("[name='input_56[]']").attr("id", 'cell3A');
+ $('.gfield_list_57_cell3').find("[name='input_57[]']").attr("id", 'cell3B');
+ $('.gfield_list_56_cell4').find("[name='input_56[]']").attr("id", 'cell4A');
+ $('.gfield_list_57_cell4').find("[name='input_57[]']").attr("id", 'cell4B');
+ $('#field_8_56 .gfield_list').attr("id", "table1");
+ $('#field_8_57 .gfield_list').attr("id", "table2");
+ table1 = $('#table1');
+ table2 = $('#table2');
+ $('#input_8_1').blur(function () {
+ input = $('#input_8_1').val();
+ //alert(input);
+ for (i = 0; i <= input; i++) {
+ el = document.createElement("option");
+ el.value = i;
+ el.text = String(i);
+ $("#cell2A").append(el);
+
+ document.getElementById('cell2B').appendChild(el);
+ }
+ });
+
+ $("#input_8_3").datepicker({
+ dateFormat: 'mm/dd/yy',
+
+ onSelect: function (dateText) {
+ arrival = $('#input_8_6').datepicker('setDate', dateText);
+ $('#input_8_60').val(arrival.val());
+ golfDate = $('#input_8_3').datepicker('getDate');
+ $("[name='input_60']").datepicker('setDate', golfDate);
+ date1 = $('#input_8_6').val();
+ date1.toString();
+ date1 = date1.replace(/\//g, "");
+ date1 = parseInt(date1, 10);
+ }
+ });
+ $("#input_8_33").datepicker({
+ dateFormat: 'mm/dd/yy',
+
+ onSelect: function (dateText) {
+ date2 = $('#input_8_33').val();
+ date2.toString();
+ date2 = date2.replace(/\//g, "");
+ date2 = parseInt(date2, 10);
+ numDays = ((date2 - date1) / 10000 + 1);
+ // cloning loop
+ $('#field_8_60').find('#input_8_60').attr("name", 'input_60[]');
+
+ if( $("#gform_8 .gfield_list_group").length > 2){
+ // for (j = 1; j < $("#gform_8 .gfield_list_group").length ; j++) {
+
+ // $("#removeRowBtn").trigger("click");
+ // $("#removeRowBtn2").trigger("click");
+
+ // }
+
+ $(".gfield_list_group").each(function(index){
+ if(index > 0){
+ $("#rowA"+ index).remove();
+ $("#rowB"+ index).remove();
+ }
+
+ })
+ }
+ for (j = 0; j < numDays - 1; j++) {
+
+ $("#rowBtn").trigger("click");
+ $("#rowBtn2").trigger("click");
+ }
+
+ $('.add_list_item').removeClass("add_list_item");
+ $('.delete_list_item').removeClass("delete_list_item");
+ for (j = 0; j < $("#field_8_56 .gfield_list tbody tr").length; j++) {
+ $("#table1 > tbody > tr").eq(j).attr("id", "rowA" + j);
+ $("#table2 > tbody > tr").eq(j).attr("id", "rowB" + j);
+
+ $("#rowA" + j).find("[name='input_56[]']").attr("id", "cell" + j);
+ $("#rowB" + j).find("[name='input_57[]']").attr("id", "cell" + j);
+ $("#cell" + j).attr("readonly", true);
+ $("#table2 #cell" + j).attr("readonly", true);
+ }
+
+ $('.gfield_list_56_cell2').find("[name='input_56[]']").attr("id", 'cell2A');
+ $('.gfield_list_57_cell2').find("[name='input_57[]']").attr("id", 'cell2B');
+ $('.gfield_list_56_cell3').find("[name='input_56[]']").attr("id", 'cell3A');
+ $('.gfield_list_57_cell3').find("[name='input_57[]']").attr("id", 'cell3B');
+ $('.gfield_list_56_cell4').find("[name='input_56[]']").attr("id", 'cell4A');
+ $('.gfield_list_57_cell4').find("[name='input_57[]']").attr("id", 'cell4B');
+ j = golfDate;
+ staticGolfDate = $('#input_8_3').datepicker('getDate');
+
+ $('#cell0').val((staticGolfDate.getMonth() + 1) + "/" + staticGolfDate.getDate() + "/" + staticGolfDate.getFullYear());
+ $('#table2 #cell0').val((j.getMonth() + 1) + "/" + j.getDate() + "/" + j.getFullYear());
+
+ for (i = 1; i < $("#field_8_57 .gfield_list tbody tr").length; i++) {
+
+ j = golfDate;
+ $('#cell' + i).val((staticGolfDate.getMonth() + 1) + "/" + (staticGolfDate.getDate() + i) + "/" + staticGolfDate.getFullYear());
+ $('#table2 #cell' + i).val((j.getMonth() + 1) + "/" + j.getDate() + "/" + j.getFullYear());
+
+ }
+
+
+ // alert($("#field_8_56 .gfield_list tbody tr.gfield_list_row_odd").length);
+ }
+ });
+ });
+ </script>
<?php wp_footer(); ?>
</body>
</html>
add_filter('widget_posts_args','modify_widget');
}
-}
\ No newline at end of file
+}
+function glm_site_scripts(){
+
+ wp_enqueue_script('jquery-ui-datepicker');
+
+ $url = "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.min.css";
+ wp_enqueue_style('jquery-ui-smoothness', $url, false, null);
+}
+add_action('wp_enqueue_scripts', 'glm_site_scripts');
+//add_filter( 'gform_column_input_2_57_1','set_column_1', 10, 5 );
+add_filter( 'gform_column_input_8_57_2','set_column_2', 10, 5 );
+add_filter( 'gform_column_input_8_57_3','set_column_3p', 10, 5 );
+//add_filter( 'gform_column_input_2_56_1','set_column_1', 10, 5 );
+add_filter( 'gform_column_input_8_56_2','set_column_2', 10, 5 );
+add_filter( 'gform_column_input_8_56_3','set_column_3', 10, 5 );
+add_filter( 'gform_column_input_8_56_4','set_column_4', 10, 5 );
+add_filter( 'gform_column_input_8_57_4','set_column_4', 10, 5 );
+
+// ajax data for number of golfers
+
+function set_column_1( $input_info, $field, $column, $value, $form_id ) {
+ return array( 'type' => 'select', 'choices' => '' );
+}
+function set_column_2( $input_info, $field, $column, $value, $form_id ) {
+ return array( 'type' => 'select', 'choices' => '' );
+}
+// tee times
+function set_column_3( $input_info, $field, $column, $value, $form_id ) {
+ return array( 'type' => 'select', 'choices' => ' ,Anytime,
+7:00 am,
+7:30 am,
+8:00 am,
+8:30 am,
+9:00 am,
+9:30 am,
+10:00 am,
+10:30 am,
+11:00 am,
+11:30 am');
+}
+function set_column_3p( $input_info, $field, $column, $value, $form_id ) {
+ return array( 'type' => 'select', 'choices' => ' ,Anytime,
+12:00 pm,
+12:30 pm,
+1:00 pm,
+1:30 pm,
+2:00 pm,
+2:30 pm,
+3:00 pm,
+3:30 pm,
+4:00 pm' );
+}
+// golf courses
+function set_column_4( $input_info, $field, $column, $value, $form_id ) {
+ return array( 'type' => 'select', 'choices' => ' ,Bucks Run,
+Eagle Glen,
+The Emerald,
+Maple Creek,
+Mt. Pleasant Country Club,
+Pine River Country Club,
+The Pines,
+Pleasant Hills,
+PohlCat,
+Riverwood Resort,
+Snow Snake'
+ );
+}
+
+function my_ajax_callback_function() {
+ $input = $_POST['input'];
+}
+add_action( 'wp_ajax_numGolfers', 'my_ajax_callback_function' ); // If called from admin panel
+add_action( 'wp_ajax_nopriv_numGolfers', 'my_ajax_callback_function' );