/* Callback function used when updating the worklocation overview.
   If just process data and then hides again the departments that were
   not delected.*/
update_vacation_overview_callback = function() {
    jq.tablefilter();
};


// Bindings for the vacation view of the worklocation.
initialize_wl_vacation_view = function($) {
    $('#save_vacation_unit').pyproxy('click',
				     'jq_update_vacation_units',
				     '#vacation_pass_update');

    $('.vacation_month_button').live('click',
				     function(e) {
					 e.preventDefault();
					 date = $(this).attr('rel');
					 $.pyproxy_call('jq_update_vacation_overview',
							{'date': date},
							update_vacation_overview_callback);
				       });

    $('.vacation_month_switcher').live('click',
				       function(e) {
					   e.preventDefault();
					   form = $(this).parent();
					   date = form.find('[name=month]').val() + '-' + form.find('[name=year]').val();
					   $.pyproxy_call('jq_update_vacation_overview',
							  {'date': date},
							  update_vacation_overview_callback);
				       });
};

