Most Viewed Organisations

<!---->
Loading...

Loading...

var url = 'https://subscribers-stg.abiq.io/wp-json/api/v1/get_public_organisations_to_list'; //var url = 'http://localhost/subscriber_abiq_staging/wp-json/api/v1/get_public_organisations_to_list'; var pageIndex_new = 0; var pageIndex_updated = 0; var pageIndex_viewed = 0; var recordCount_new = 0; var recordCount_updated = 0; var recordCount_viewed = 0; const MOSTVIEWD = 'MostVisited'; const NEWLYCREATED = 'NewlyCreated'; const RECENTLYUPDATED = 'RecentlyUpdated'; var pagesize = 20; var $paginationBox; jQuery(document).ready(function() { $paginationBox = jQuery('.pagination-box'); let opt = { page: 1, limit: pagesize, total: 999, pageShow: 5, clickFun: function(page, limit, total, pageTotal, pageShow) { updateonPageSelection(page, limit, total, pageTotal, pageShow); } }; // step-3 $paginationBox.pagination(opt); fetchDataForPublic('new', updateUINewFacilitiesList); fetchDataForPublic('updated', updateUIUpdatedFacilitiesList); fetchDataForPublic('viewed', updateUIViewwedFacilitiesList); /*--------------------------------------------------------------------------------------------------------*/ jQuery('#btn_paging_next_viewwed').click(function() { pageIndex_viewed = pageIndex_viewed + 1; fetchDataForPublic('viewed', updateUIViewwedFacilitiesList); }); jQuery('#btn_paging_prev_viewed').click(function() { if (pageIndex_viewed > 0) { pageIndex_viewed = pageIndex_viewed - 1; fetchDataForPublic('viewed', updateUIViewwedFacilitiesList); } }); /*--------------------------------------------------------------------------------------------------------*/ jQuery('#btn_paging_next_updated').click(function() { pageIndex_updated = pageIndex_updated + 1; fetchDataForPublic('updated', updateUIUpdatedFacilitiesList); }); jQuery('#btn_paging_prev_updated').click(function() { if (pageIndex_updated > 0) { pageIndex_updated = pageIndex_updated - 1; fetchDataForPublic('updated', updateUIUpdatedFacilitiesList); } }); /*--------------------------------------------------------------------------------------------------------*/ jQuery('#btn_paging_next_new').click(function() { pageIndex_new = pageIndex_new + 1; fetchDataForPublic('new', updateUINewFacilitiesList); }); jQuery('#btn_paging_prev_new').click(function() { if (pageIndex_new > 0) { pageIndex_new = pageIndex_new - 1; fetchDataForPublic('new', updateUINewFacilitiesList); } }); }); function fetchDataForPublic(viewtype, returnFunction) { var urlWithParams = ''; switch (viewtype) { case 'new': urlWithParams = url + '/' + NEWLYCREATED + '/' + pageIndex_new + '/' + pagesize; break; case 'updated': urlWithParams = url + '/' + RECENTLYUPDATED + '/' + pageIndex_updated + '/' + pagesize; break; case 'viewed': urlWithParams = url + '/' + MOSTVIEWD + '/' + pageIndex_viewed + '/' + pagesize; break; default: urlWithParams = ''; } jQuery('#spriiing_loading_panel').show(); fetch(urlWithParams) .then(response => { jQuery('#spriiing_loading_panel').hide(); return response.json(); }) .then(data => { jQuery('#spriiing_loading_panel').hide(); if (data && data.Profiles) { //console.log(data); returnFunction(data); } }) .catch((error) => { jQuery('#spriiing_loading_panel').hide(); console.log(error); }); } function updateUINewFacilitiesList(data) { var newFacilities = (data.Profiles) ? data.Profiles : []; var arrLi = []; if (newFacilities.length > 0) { recordCount_new = (data.RecordCount) ? parseInt(data.RecordCount) : 0; jQuery('#ulNew').empty(); newFacilities.forEach((org) => { var arrInfoItems = []; if (org.Industry && org.Industry != undefined && org.Industry != null) { arrInfoItems.push('Type: ' + org.Industry + ''); } if (org.Ownership && org.Ownership != undefined && org.Ownership != null) { arrInfoItems.push('Ownership: ' + org.Ownership + ''); } if (org.Country && org.Country != undefined && org.Country != null) { arrInfoItems.push('Country: ' + org.Country + ''); } strItem = arrInfoItems.join(' | '); var li = '
  • ' + '' + org.OrganisationName + '
    ' + strItem + '
    '; arrLi.push(li); }); jQuery('#ulNew').append(arrLi.join('')); update_footer_text_new(); } } function updateUIUpdatedFacilitiesList(data) { var updatedFacilities = (data.Profiles) ? data.Profiles : []; var arrLi = []; if (updatedFacilities.length > 0) { recordCount_updated = (data.RecordCount) ? parseInt(data.RecordCount) : 0; jQuery('#ulUpdated').empty(); updatedFacilities.forEach((org) => { var arrInfoItems = []; if (org.Industry && org.Industry != undefined && org.Industry != null) { arrInfoItems.push('Type: ' + org.Industry + ''); } if (org.Ownership && org.Ownership != undefined && org.Ownership != null) { arrInfoItems.push('Ownership: ' + org.Ownership + ''); } if (org.Country && org.Country != undefined && org.Country != null) { arrInfoItems.push('Country: ' + org.Country + ''); } strItem = arrInfoItems.join(' | '); var li = '
  • ' + '' + org.OrganisationName + '
    ' + strItem + '
    '; arrLi.push(li); }); jQuery('#ulUpdated').append(arrLi.join('')); update_footer_text_updated(); } } function updateUIViewwedFacilitiesList(data) { var mostViewedFacilities = (data.Profiles) ? data.Profiles : []; var arrLi = []; if (mostViewedFacilities.length > 0) { recordCount_viewed = (data.RecordCount) ? parseInt(data.RecordCount) : 0; if (pageIndex_viewed == 0) { $paginationBox.pagination('update', { total: recordCount_viewed }); $paginationBox.pagination('refresh'); } jQuery('#ulViewed').empty(); mostViewedFacilities.forEach((org) => { var arrInfoItems = []; if (org.Industry && org.Industry != undefined && org.Industry != null) { arrInfoItems.push('Type: ' + org.Industry + ''); } if (org.Ownership && org.Ownership != undefined && org.Ownership != null) { arrInfoItems.push('Ownership: ' + org.Ownership + ''); } if (org.Country && org.Country != undefined && org.Country != null) { arrInfoItems.push('Country: ' + org.Country + ''); } strItem = arrInfoItems.join(' | '); var li = '
  • ' + '' + org.OrganisationName + '
    ' + strItem + '
    '; arrLi.push(li); }); jQuery('#ulViewed').append(arrLi.join('')); update_footer_text_viewed(); } } function updateonPageSelection(page, limit, total, pageTotal, pageShow) { //console.log("click fun: page = ", page, "limit = ", limit, "total = ", total, "pageTotal = ", pageTotal, "pageShow = ", pageShow); pageIndex_viewed = page - 1; fetchDataForPublic('viewed', updateUIViewwedFacilitiesList); } function update_footer_text_viewed() { var fromText = (((pageIndex_viewed) * pagesize + 1)); var toText = (((((pageIndex_viewed) * pagesize + 1) + pagesize) - 1) > recordCount_viewed) ? recordCount_viewed : ((((pageIndex_viewed) * pagesize + 1) + pagesize) - 1); var ofText = recordCount_viewed; var foterMessage = "Displaying " + fromText.toLocaleString() + " to " + toText.toLocaleString() + " of " + ofText.toLocaleString() + " records."; jQuery('#lblFooterMessage_viewwed').text(foterMessage); } function update_footer_text_updated() { var fromText = (((pageIndex_updated) * pagesize + 1)); var toText = (((((pageIndex_updated) * pagesize + 1) + pagesize) - 1) > recordCount_updated) ? recordCount_updated : ((((pageIndex_updated) * pagesize + 1) + pagesize) - 1); var ofText = recordCount_updated; var foterMessage = "Displaying " + fromText.toLocaleString() + " to " + toText.toLocaleString() + " of " + ofText.toLocaleString() + " records."; jQuery('#lblFooterMessage_updated').text(foterMessage); } function update_footer_text_new() { var fromText = (((pageIndex_new) * pagesize + 1)); var toText = (((((pageIndex_new) * pagesize + 1) + pagesize) - 1) > recordCount_new) ? recordCount_new : ((((pageIndex_new) * pagesize + 1) + pagesize) - 1); var ofText = recordCount_new; var foterMessage = "Displaying " + fromText.toLocaleString() + " to " + toText.toLocaleString() + " of " + ofText.toLocaleString() + " records."; jQuery('#lblFooterMessage_new').text(foterMessage); }
  • Looking to generate leads and develop your business in Africa and the Middle East?
    Book a free demo.

    You have Successfully Subscribed!

    Did you find what you were looking for?

    Join our mailing list to receive the latest news and updates from our team.