| @@ -1,5 +1,5 @@ | ||
| 1 | -jQuery(window).load(function() | |
| 1 | +jQuery(window).on('load', function() | |
| 2 | 2 | { |
| 3 | 3 | // Load news |
| 4 | 4 | var data = { |
| 5 | 5 | action: 'propertyhive_get_news', |
| @@ -43,7 +43,56 @@ | ||
| 43 | 43 | { |
| 44 | 44 | jQuery('#ph_dashboard_viewings_awaiting_applicant_feedback ul').append('<li><a class="rsswidget" style="font-weight:400" href="' + response[i].edit_link + '">' + response[i].applicant_name + '</a> viewed <a class="rsswidget" style="font-weight:400" href="' + response[i].edit_link + '">' + response[i].property_address + '</a><br><small style="opacity:0.85">' + response[i].start_date_time_formatted_Hi_jSFY + '</small></li>'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + }, 'json'); | |
| 48 | + } | |
| 49 | + | |
| 50 | + // Load my upcoming appointments, if div is present (i.e. if viewings module etc hasn't been disabled) | |
| 51 | + if ( jQuery('#ph_dashboard_my_upcoming_appointments').length > 0 ) | |
| 52 | + { | |
| 53 | + var data = { | |
| 54 | + action: 'propertyhive_get_my_upcoming_appointments', | |
| 55 | + security: 'get-my-upcoming-appointments' | |
| 56 | + }; | |
| 57 | + | |
| 58 | + jQuery.post(propertyhive_dashboard.ajax_url, data, function(response) | |
| 59 | + { | |
| 60 | + if ( response == '' || response.length == 0 ) | |
| 61 | + { | |
| 62 | + jQuery('#ph_dashboard_my_upcoming_appointments').html('No upcoming appointments found'); | |
| 63 | + return; | |
| 64 | + } | |
| 65 | + | |
| 66 | + jQuery('#ph_dashboard_my_upcoming_appointments').html('<ul></ul>') | |
| 67 | + for ( var i in response ) | |
| 68 | + { | |
| 69 | + jQuery('#ph_dashboard_my_upcoming_appointments ul').append('<li><a class="rsswidget" style="font-weight:400" href="' + response[i].edit_link + '">' + response[i].title + '</a><br><small style="opacity:0.85">' + response[i].start_date_time_formatted_Hi_jSFY + '</small></li>'); | |
| 70 | + } | |
| 71 | + | |
| 72 | + }, 'json'); | |
| 73 | + } | |
| 74 | + | |
| 75 | + // Load upcoming and overdue key dates, if div is present (i.e. if management module hasn't been disabled) | |
| 76 | + if ( jQuery('#ph_dashboard_upcoming_overdue_key_dates').length > 0 ) | |
| 77 | + { | |
| 78 | + var data = { | |
| 79 | + action: 'propertyhive_get_upcoming_overdue_key_dates', | |
| 80 | + security: 'get_upcoming_overdue_key_dates' | |
| 81 | + }; | |
| 82 | + | |
| 83 | + jQuery.post(propertyhive_dashboard.ajax_url, data, function(response) | |
| 84 | + { | |
| 85 | + if ( response == '' || response.length == 0 ) | |
| 86 | + { | |
| 87 | + jQuery('#ph_dashboard_upcoming_overdue_key_dates').html('No upcoming key dates found'); | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + | |
| 91 | + jQuery('#ph_dashboard_upcoming_overdue_key_dates').html('<ul></ul>') | |
| 92 | + for ( var i in response ) | |
| 93 | + { | |
| 94 | + jQuery('#ph_dashboard_upcoming_overdue_key_dates ul').append('<li><a class="rsswidget" style="font-weight:400" href="' + response[i].key_date_edit_link + '">' + response[i].description + '</a> ' + response[i].upcoming_overdue_status + ' on <a class="rsswidget" style="font-weight:400" href="' + response[i].property_edit_link + '">' + response[i].property_address + '</a><br><small style="opacity:0.85">' + response[i].due_date_time_formatted + '</small></li>'); | |
| 95 | + } | |
| 47 | 96 | }, 'json'); |
| 48 | 97 | } |
| 49 | 98 | }); |