ESTUDIO DE MERCADO INMOBILIARIO DE LAS CIUDADES DE COBIJA, EL ALTO, ORURO, COCHABAMBA, SACABA, EL TORNO, POTOSÍ, SUCRE, TARIJA, SANTA CRUZ DE LA SIERRA, VIACHA Y TRINIDAD (2022)

' ); /* need to escape bad chars in title - slash causes error */ jQuery.ajax({ url: Drupal.settings.basePath + "delete-saved-search/" + nid, type: 'POST', dataType: 'json', error: function (XMLHttpRequest, textStatus, errorThrown) { // console.log(JSON.stringify(XMLHttpRequest)); // console.log(JSON.stringify(textStatus)); // console.log(JSON.stringify(errorThrown)); alert("Sorry, we encountered a technical issue while deleting your search."); }, success: function (data) { // console.log(data); /* is the menu callback necessary for this view or can we just call it directly? is the view's access restrictions honored if we call it directly? */ jQuery.ajax({ url: "/load-saved-searches", cache: false }) .done(function( html ) { jQuery( "#my_saved_searches" ).html( html ); jQuery( "#count_saved_searches" ).html(jQuery( "#my_saved_searches" ).children().length); }); } }); } function loadCompanySearchData(data, appendBool) { if (!appendBool) { jQuery(".sitesearch_results" ).empty(); jQuery(".sectorButtons" ).empty(); jQuery(".countryButtons" ).empty(); jQuery(".apachesolr_search-results" ).empty(); jQuery(".sitesearch_pagination" ).empty(); } var start = data.response.start; var rows_per_page = resultsPerScroll; var resultsStart = data.response.start + 1; var resultsEnd = rows_per_page; var resultsFound = data.response.numFound; globalResultsFound = resultsFound; // console.log("resultsFound 443: " + resultsFound); // console.log("globalResultsFound 443: " + globalResultsFound); if (resultsFound == 0) { jQuery(".sitesearch_results").append("Sorry, no results could be found."); jQuery(".sitesearch_results_area").removeClass("loading"); // reset all facet fields } else { if (!appendBool) { jQuery(".sitesearch_results").append(resultsFound + " results"); // flatten the fq variable if it is an array var response_fq = ""; if (typeof data.responseHeader.params.fq !== 'undefined') { if (typeof data.responseHeader.params.fq == 'object') { response_fq = JSON.stringify(data.responseHeader.params.fq); } else { response_fq = data.responseHeader.params.fq; } } // facet bundles // disable all facets if user is not logged in var disabled = ""; if (Drupal.settings.authorizedUser == 0) { disabled = " disabled=\"disabled\""; } // Sectors: extra processing due to hierarchy jQuery.each(drupalTaxonomySectorsData,function(i,term){ jQuery.each(data.facet_counts.facet_fields.sm_vid_Sectors,function(index,value){ // fix & = & // fix Other- = Other - var drupalStyleIndex = index.replace("&", "&"); drupalStyleIndex = drupalStyleIndex.replace("Other-", "Other -"); if (term.name == drupalStyleIndex) { var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } if (term.parents == 0) { jQuery( ".sectorButtons" ).append("

"); } else { jQuery( ".sectorButtons" ).append("

"); } } }); }); // update select jQuery(".sectorButtons").trigger("chosen:updated"); jQuery.each(drupalTaxonomyCountriesData,function(i,term){ jQuery.each(data.facet_counts.facet_fields.sm_vid_Countries,function(index,value){ if (term.name == index) { var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } if (term.parents == 0) { jQuery( ".countryButtons" ).append("

"); } else { jQuery( ".countryButtons" ).append("

"); } } }); }); // update select jQuery(".countryButtons").trigger("chosen:updated"); } jQuery.each(data.response.docs,function(i,doc){ var sectors = ""; var sectorParents = []; if (doc.sm_vid_Sectors != undefined) { jQuery.each(doc.sm_vid_Sectors,function(index,value){ // fix & = & // fix Other- = Other - value = value.replace("&", "&"); value = value.replace("Other-", "Other -"); jQuery.each(drupalTaxonomySectorsData, function(drupalIndex,drupalValue) { if (value == drupalValue.name) { // sector parents if (drupalValue.parents[0] == "0") { // add to parent sectorParents.push(value); } } }); }); } jQuery.each(jQuery.uniqueSort(sectorParents), function(index, value) { var escapedValue = value.toLowerCase(); escapedValue = escapedValue.replace(/ /g, "_"); escapedValue = escapedValue.replace(/,/g, "_"); sectors += "ESTUDIO DE MERCADO INMOBILIARIO DE LAS CIUDADES DE COBIJA, EL ALTO, ORURO, COCHABAMBA, SACABA, EL TORNO, POTOSÍ, SUCRE, TARIJA, SANTA CRUZ DE LA SIERRA, VIACHA Y TRINIDAD (1)"; }); var result_doc_id = doc.id; var countries = ""; if (doc.sm_vid_Countries != undefined) { // odd entries are the parents, don't show jQuery.each(doc.sm_vid_Countries,function(index,value){ if (index == 0) { countries = value; } else if (index % 2 == 0) { countries += ", " + value; } }); } var row_classes = ""; var article_classes = ""; if (i == 0) { row_classes = "views-row-odd views-row-first"; article_classes = "odd"; } else { var row_iter = i + 1; if (row_iter % 2 == 0) { // row_classes = "views-row-even"; // article_classes = "even"; } else { // row_classes = "views-row-odd"; // article_classes = "odd"; } } var result_row = "

"; result_row += "

"; result_row += "

"; result_row += "" + doc.label + ""; if (Drupal.settings.authorizedUser > 0) { if (doc.sm_af_thoroughfare != undefined) { result_row += "
"; result_row += doc.sm_af_thoroughfare; } result_row += "
"; if (doc.sm_af_locality != undefined) { result_row += doc.sm_af_locality ; } if (doc.sm_af_administrative_area != undefined) { result_row += " " + doc.sm_af_administrative_area; } if (doc.sm_af_postal_code != undefined) { result_row += " " + doc.sm_af_postal_code; } if (doc.sm_af_country != undefined) { result_row += "
"; result_row += doc.sm_af_country; } result_row += "
"; if (doc.sm_field_phone != undefined) { result_row += doc.sm_field_phone; } if (doc.sm_field_company_website_url != undefined) { result_row += " Visit Website "; } if (doc.sm_field_email != undefined) { result_row += doc.sm_field_email; } } result_row += "

"; result_row += "

" + sectors + "

"; result_row += "

"; jQuery( ".apachesolr_search-results" ).append( result_row ); }); // pagination jQuery( ".sitesearch_results_area" ).removeClass("loading"); jQuery(".countryCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".sectorCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); } } function loadSitesearchData(data, appendBool) { if (!appendBool) { jQuery(".sitesearch_results" ).empty(); jQuery(".institutionButtons" ).empty(); jQuery(".procurementTypeButtons" ).empty(); jQuery(".statusButtons").empty(); jQuery(".individualConsultingButtons").empty(); jQuery(".sectorButtons" ).empty(); jQuery(".countryButtons" ).empty(); jQuery(".languageButtons" ).empty(); jQuery(".noticeTypeButtons" ).empty(); jQuery(".apachesolr_search-results" ).empty(); jQuery(".sitesearch_pagination" ).empty(); jQuery("#currently_viewing_bundle" ).empty(); // jQuery("#sort").empty(); } var start = data.response.start; var rows_per_page = resultsPerScroll; var resultsStart = data.response.start + 1; var resultsEnd = rows_per_page; var resultsFound = data.response.numFound; globalResultsFound = resultsFound; // console.log("resultsFound 443: " + resultsFound); // console.log("globalResultsFound 443: " + globalResultsFound); if (resultsFound == 0) { jQuery(".sitesearch_results").append("Sorry, no results could be found."); jQuery(".sitesearch_results_area").removeClass("loading"); // remove all leftover facets jQuery(".institutionButtons").children().remove(); jQuery(".institutionButtons").trigger("chosen:updated"); jQuery(".statusButtons").children().remove(); jQuery(".statusButtons").trigger("chosen:updated"); jQuery(".sectorButtons").children().remove(); jQuery(".sectorButtons").trigger("chosen:updated"); jQuery(".countryButtons").children().remove(); jQuery(".countryButtons").trigger("chosen:updated"); jQuery(".procurementTypeButtons").children().remove(); jQuery(".procurementTypeButtons").trigger("chosen:updated"); jQuery(".individualConsultingButtons").children().remove(); jQuery(".individualConsultingButtons").trigger("chosen:updated"); jQuery(".languageButtons").children().remove(); jQuery(".languageButtons").trigger("chosen:updated"); jQuery(".noticeTypeButtons").children().remove(); jQuery(".noticeTypeButtons").trigger("chosen:updated"); } else { if (!appendBool) { var monthly_operational_summary_bundle = ""; jQuery(".sitesearch_results").append(resultsFound + " results"); // flatten the fq variable if it is an array var response_fq = ""; if (typeof data.responseHeader.params.fq !== 'undefined') { if (typeof data.responseHeader.params.fq == 'object') { response_fq = JSON.stringify(data.responseHeader.params.fq); response_fq_json_parsed = JSON.parse(response_fq); } else { response_fq = data.responseHeader.params.fq; } } // console.log(response_fq); // facet bundles // disable all facets if user is not logged in var disabled = ""; if (Drupal.settings.authorizedUser == 0) { disabled = " disabled=\"disabled\""; } jQuery.each(data.facet_counts.facet_fields.sm_vid_Institutions,function(index,value){ var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { // checked = " checked=\"checked\""; checked = " selected=\"selected\""; } jQuery( ".institutionButtons" ).append("

"); }); // update select jQuery(".institutionButtons").trigger("chosen:updated"); // if (response_fq.indexOf("tagForStatusCancelled") > -1) { if (response_fq.indexOf("bundle:(procurement_notice)") > -1) {// console.log("procurement_notice for status field"); var cancelled = 0; var closed = 0; var open = 0; if (data.facet_counts.facet_fields.sm_vid_Notice_Status.Cancelled != undefined) { cancelled = data.facet_counts.facet_fields.sm_vid_Notice_Status.Cancelled; } if (data.facet_counts.facet_ranges.ds_field_deadline.before != undefined) { closed = data.facet_counts.facet_ranges.ds_field_deadline.before; } if (data.facet_counts.facet_ranges.ds_field_deadline.after != undefined) { open = data.facet_counts.facet_ranges.ds_field_deadline.after; } var cancelledChecked = ""; var openChecked = ""; var closedChecked = ""; if (response_fq.indexOf("tagForStatusCancelled") > -1) { // checked = " checked=\"checked\""; cancelledChecked = " selected=\"selected\""; } if (response_fq.indexOf("tagForStatusOpen") > -1) { // checked = " checked=\"checked\""; openChecked = " selected=\"selected\""; } if (response_fq.indexOf("tagForStatusClosed") > -1) { // checked = " checked=\"checked\""; closedChecked = " selected=\"selected\""; } jQuery( ".statusButtons" ).append("

"); jQuery( ".statusButtons" ).append("

"); jQuery( ".statusButtons" ).append("

"); // update select jQuery(".statusButtons").trigger("chosen:updated"); } else if (response_fq.indexOf("bundle:(monthly_operational_summary)") > -1) {// console.log("monthly_operational_summary for status field"); jQuery.each(data.facet_counts.facet_fields.sm_vid_Operational_Summary_Status,function(index,value){ var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } jQuery( ".statusButtons" ).append("

"); }); // update select jQuery(".statusButtons").trigger("chosen:updated"); } // Sectors: extra processing due to hierarchy jQuery.each(drupalTaxonomySectorsData,function(i,term){ jQuery.each(data.facet_counts.facet_fields.sm_vid_Sectors,function(index,value){ // fix & = & // fix Other- = Other - var drupalStyleIndex = index.replace("&", "&"); drupalStyleIndex = drupalStyleIndex.replace("Other-", "Other -"); drupalStyleIndex = drupalStyleIndex.replace("General-", "General -"); if (term.name == drupalStyleIndex) { var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } if (term.parents == 0) { jQuery( ".sectorButtons" ).append("

"); } else { jQuery( ".sectorButtons" ).append("

"); } } }); }); // update select jQuery(".sectorButtons").trigger("chosen:updated"); // Countries: extra processing due to hierarchy jQuery.each(drupalTaxonomyCountriesData,function(i,term){ jQuery.each(data.facet_counts.facet_fields.sm_vid_Countries,function(index,value){// console.log("index: " + index + " == term.name: " + term.name); var index_to_match = index.replace(/'/g, "'");// console.log("index_to_match: " + index_to_match + " == term.name: " + term.name); // if (term.name == index) { if (term.name == index_to_match) { var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } if (term.parents == 0) { jQuery( ".countryButtons" ).append("

"); } else { jQuery( ".countryButtons" ).append("

"); } } }); }); // update select jQuery(".countryButtons").trigger("chosen:updated"); jQuery.each(data.facet_counts.facet_fields.sm_vid_Procurement_Type,function(index,value){ var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } jQuery( ".procurementTypeButtons" ).append("

"); }); // update select jQuery(".procurementTypeButtons").trigger("chosen:updated"); jQuery.each(data.facet_counts.facet_fields.bm_field_individual_consulting,function(index,value){ var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } jQuery( ".individualConsultingButtons" ).append("

"); }); // update select jQuery(".individualConsultingButtons").trigger("chosen:updated"); jQuery.each(data.facet_counts.facet_fields.sm_vid_Languages,function(index,value){ var checked = ""; if (response_fq.indexOf(index) > -1) { var checked = " selected=\"selected\""; } jQuery( ".languageButtons" ).append("

"); }); // update select jQuery(".languageButtons").trigger("chosen:updated"); jQuery.each(data.facet_counts.facet_fields.sm_vid_Notice_type,function(index,value){ var checked = ""; if (response_fq.indexOf("\\\"" + index + "\\\"") > -1) { var checked = " selected=\"selected\""; } jQuery( ".noticeTypeButtons" ).append("

"); }); // update select jQuery(".noticeTypeButtons").trigger("chosen:updated"); } jQuery.each(data.response.docs,function(i,doc){ if (i == 0 && (!appendBool) ) { var bundleLabel = ""; if (doc.bundle == "monthly_operational_summary") { bundleLabel = "Operational Summaries"; } else if (doc.bundle == "procurement_notice") { bundleLabel = "Procurement Notices"; } else if (doc.bundle == "contract_award") { bundleLabel = "Contract Awards"; } jQuery("#currently_viewing_bundle" ).append("

" + bundleLabel + "

"); if (doc.bundle == "procurement_notice") { jQuery("#statusPanel" ).removeClass("hide"); jQuery("#noticeTypePanel" ).removeClass("hide"); jQuery("#deadlinePanel").removeClass("hide"); jQuery("#datePostedPanel").removeClass("hide"); jQuery("#status_mos_only").addClass("hide"); jQuery("#status_pn_only").removeClass("hide"); if (doc.bundle_name != orgBundleForSort) { jQuery("#sort").empty(); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); } } else if (doc.bundle == "monthly_operational_summary") { jQuery("#statusPanel" ).removeClass("hide"); jQuery("#noticeTypePanel" ).addClass("hide"); jQuery("#deadlinePanel").addClass("hide"); jQuery("#languagePanel").addClass("hide"); jQuery("#procurementTypePanel").addClass("hide"); jQuery("#datePostedPanel").addClass("hide"); jQuery("#status_mos_only").removeClass("hide"); jQuery("#status_pn_only").addClass("hide"); if (doc.bundle_name != orgBundleForSort) { jQuery("#sort").empty(); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); } } else { jQuery("#datePostedPanel").removeClass("hide"); jQuery("#statusPanel" ).addClass("hide"); jQuery("#noticeTypePanel" ).addClass("hide"); jQuery("#deadlinePanel").addClass("hide"); jQuery("#status_mos_only").addClass("hide"); jQuery("#status_pn_only").addClass("hide"); if (doc.bundle_name != orgBundleForSort) { jQuery("#sort").empty(); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); jQuery("#sort").append("

"); } } orgBundleForSort = doc.bundle_name; } var sectorParents = []; if (doc.sm_vid_Sectors != undefined) { jQuery.each(doc.sm_vid_Sectors,function(index,value){ // fix & = & // fix Other- = Other - value = value.replace("&", "&"); value = value.replace("Other-", "Other -"); jQuery.each(drupalTaxonomySectorsData, function(drupalIndex,drupalValue) { if (value == drupalValue.name) { // sector parents if (drupalValue.parents[0] == "0") { // add to parent sectorParents.push(value); } else { } } }); }); } var sectors = ""; jQuery.each(jQuery.uniqueSort(sectorParents), function(index, value) { var escapedValue = value.toLowerCase(); escapedValue = escapedValue.replace(/ /g, "_"); escapedValue = escapedValue.replace(/,/g, "_"); sectors += "

ESTUDIO DE MERCADO INMOBILIARIO DE LAS CIUDADES DE COBIJA, EL ALTO, ORURO, COCHABAMBA, SACABA, EL TORNO, POTOSÍ, SUCRE, TARIJA, SANTA CRUZ DE LA SIERRA, VIACHA Y TRINIDAD (2)

"; }); if (sectors.length) {sectors = "

" + sectors + "

"; } var result_doc_id = doc.id; var countries = ""; if (doc.sm_vid_Countries != undefined) { // odd entries are the parents, don't show jQuery.each(doc.sm_vid_Countries,function(index,value){ if (index == 0) { countries = value; } else if (index % 2 == 0) { countries += ", " + value; } }); } var procurement_types = ""; var institutions = ""; if (doc.sm_vid_Institutions != undefined) { institutions = doc.sm_vid_Institutions.join(', '); } jQuery.each(doc.sm_vid_Procurement_Type,function(index,value){ procurement_types += "" + value.charAt(0) + ""; }); var deadline = "Unspecified"; var deadlineDate; var nowDate = new Date(); var status = "N/A"; if (doc.ds_field_deadline != undefined) {// solr stores drupal db date in utc instead of NY timezone deadlineDate = new Date(doc.ds_field_deadline); // get UTC offset in minutes var offsetInMinutes = new Date().getTimezoneOffset(); // convert to microseconds var offsetInMicroseconds = offsetInMinutes * 60 * 1000; // convert to NY timezone by adding UTC offsetdeadlineDate = new Date(deadlineDate.getTime() + offsetInMicroseconds); deadline = deadlineDate.getDate() + " " + months[deadlineDate.getMonth()] + " " + deadlineDate.getFullYear() ; // status = "Open" if before any deadline; "Closed" if after last deadline if (nowDate.getTime() > deadlineDate.getTime()) { status = "Closed"; } else { status = "Open"; } } if (doc.bundle == "contract_award") { if (doc.sm_vid_Notice_Status != undefined && doc.sm_vid_Notice_Status != "Not cancelled") { status = doc.sm_vid_Notice_Status; } else { status = "Awarded"; } } else if (doc.bundle == "monthly_operational_summary") { status = doc.sm_vid_Operational_Summary_Status; } else if (doc.sm_vid_Notice_Status != undefined && doc.sm_vid_Notice_Status != "Not cancelled") { status = doc.sm_vid_Notice_Status; } var changedDate = new Date(doc.ds_changed); var changed = changedDate.getDate() + " " + months[changedDate.getMonth()] + " " + changedDate.getFullYear(); var changedDifference = nowDate.getTime() - changedDate.getTime(); var changedDifferenceDays = Math.round(changedDifference / 86400000); var futurePostingDate; var futurePosting; if (doc.bundle == 'monthly_operational_summary') { futurePostingDate = new Date(doc.ds_created); futurePosting = futurePostingDate.getDate() + " " + months[futurePostingDate.getMonth()] + " " + futurePostingDate.getFullYear(); } else { futurePostingDate = new Date(doc.ds_field_future_posting_date); futurePostingDate = new Date(futurePostingDate.getTime() + 21600000); futurePosting = futurePostingDate.getDate() + " " + months[futurePostingDate.getMonth()] + " " + futurePostingDate.getFullYear(); } var lastUpdatedDifferenceDays; if (doc.ds_field_last_updated != undefined) { var lastUpdatedDate = new Date(doc.ds_field_last_updated); var lastUpdated = lastUpdatedDate.getDate() + " " + months[lastUpdatedDate.getMonth()] + " " + lastUpdatedDate.getFullYear(); var lastUpdatedDifference = nowDate.getTime() - lastUpdatedDate.getTime(); lastUpdatedDifferenceDays = Math.round(lastUpdatedDifference / 86400000); } var row_classes = ""; var article_classes = ""; if (i == 0) { row_classes = "views-row-odd views-row-first"; article_classes = "odd"; } else { var row_iter = i + 1; if (row_iter % 2 == 0) { // row_classes = "views-row-even"; // article_classes = "even"; } else { // row_classes = "views-row-odd"; // article_classes = "odd"; } } var favorite_star_icon = "fa-star-o"; var favorite_bool = 1; var toggle_id = doc.entity_id; if (favoritesAjaxArray != undefined) { jQuery.each(favoritesAjaxArray.nodes,function(i){ if (favoritesAjaxArray.nodes[i].node.entity_nid == doc.entity_id) { favorite_star_icon = "fa-star"; favorite_bool = 0; // remove the favorite, not the underlying content toggle_id = favoritesAjaxArray.nodes[i].node.favorite_nid; } }); } var result_row = "

"; if (sectors.length > 0) { result_row += "

" + sectors + "

"; result_row += "

"; } else { result_row += "

"; } result_row += "

"; result_row += "

"; result_row += procurement_types + "" + countries + " | " + institutions + "" ; if (lastUpdatedDifferenceDays != undefined) {result_row += ""; if (lastUpdatedDifferenceDays == 0) { result_row += " Last updated today "; } else if (lastUpdatedDifferenceDays == 1) { result_row += " Last updated yesterday "; } else { result_row += " Last updated " + lastUpdatedDifferenceDays + " days ago "; }result_row += ""; } if (doc.bundle != 'monthly_operational_summary') { result_row += "

"; } result_row += "

"; result_row += "

"; result_row += "

"; result_row += "

"; result_row += "

"; result_row += "

"; result_row += "Title"; result_row += "

"; result_row += "

"; if (Drupal.settings.authorizedUser == 1 || doc.bs_field_public == true) { result_row += "" + doc.label + ""; } else { result_row += "" + doc.label + ""; } result_row += "

"; result_row += "

"; if (doc.bundle != 'monthly_operational_summary') { result_row += "

"; result_row += "

"; result_row += "Project"; result_row += "

"; result_row += "

"; result_row += doc.ts_field_project_name ; result_row += "

"; result_row += "

"; } result_row += "

"; result_row += "

"; result_row += "Date Posted" + "
" + futurePosting; result_row += "

"; result_row += "

"; result_row += "Status
" + status; result_row += "

"; result_row += "

"; if (doc.bundle == 'monthly_operational_summary') { result_row += "Issue" + "
" + doc.sm_field_issue_number; } else { result_row += "DB Reference No" + "
" + doc.ss_field_db_ref_no_; } result_row += "

"; result_row += "

"; if (doc.bundle == 'procurement_notice') {result_row += "

"; result_row += "

";result_row += "Deadline " + deadline; result_row += "

"; result_row += "

"; } result_row += "

"; result_row += "

"; jQuery( ".apachesolr_search-results" ).append( result_row ); }); // pagination jQuery( ".sitesearch_results_area" ).removeClass("loading"); jQuery(".institutionCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".procurementTypeCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".countryCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".sectorCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".languageCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); jQuery(".noticeTypeCheckbox").click(function(){ if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); } }); } jQuery('[data-toggle="tooltip"]').tooltip(); } function loadSitesearchImages(data) { if (data !== null) { jQuery.each(data,function(key,val){ jQuery("#node-" + key + " .pub-image").html("ESTUDIO DE MERCADO INMOBILIARIO DE LAS CIUDADES DE COBIJA, EL ALTO, ORURO, COCHABAMBA, SACABA, EL TORNO, POTOSÍ, SUCRE, TARIJA, SANTA CRUZ DE LA SIERRA, VIACHA Y TRINIDAD (3)"); }); } } function returnSelectedSortTypeButton() { var sort_type_local = ""; var sortValue = jQuery('#sort').find(":selected").val(); if (sortValue != undefined) { var sortValueArray = sortValue.split("--"); sort_type_local = sortValueArray[0]; } return sort_type_local; } function returnSelectedSortOrderButton() { var sort_order_local = ""; var sortValue = jQuery('#sort').find(":selected").val(); if (sortValue != undefined) { var sortValueArray = sortValue.split("--"); sort_order_local = sortValueArray[1]; } return sort_order_local; } function returnSelectedBundleNameButtons() { var multivalue_facet_queryphrase_local = ""; jQuery(".bundleNameBtn.btn-primary").each(function(){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + jQuery(this).attr("value") + "\""; } else { multivalue_facet_queryphrase_local += "\"" + jQuery(this).attr("value") + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedCountryCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(countryButtonsSelectionArray,function(index,value){ // escape single quote value = value.replace(/'/, "%26%23039%3B"); if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedInstitutionCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(institutionButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedStatusCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(statusButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } });// console.log("returnSelectedStatusCheckboxes: " + multivalue_facet_queryphrase_local); return multivalue_facet_queryphrase_local; } function returnSelectedIndividualConsultingCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(individualConsultingButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedSectorCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(sectorButtonsSelectionArray,function(index,value){ // fix & = & // fix Other- = Other - value = value.replace("&", "&"); value = value.replace("Other -", "Other-"); if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedNonFacetCheckboxes(checkboxName) { var multivalue_facet_queryphrase_local = ""; jQuery("[name='" + checkboxName + "Checkbox']:checked").each(function(){ var value = jQuery(this).attr("value"); value = value.replace("&", "&"); if (multivalue_facet_queryphrase_local.length > 0) { // multivalue_facet_queryphrase_local += " OR \"" + jQuery(this).attr("value") + "\""; multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedProcurementTypeCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(procurementTypeButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedLanguageCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(languageButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedNoticeTypeCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery.each(noticeTypeButtonsSelectionArray,function(index,value){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + value + "\""; } else { multivalue_facet_queryphrase_local += "\"" + value + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedRegionCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery(".regionCheckbox:checked").each(function(){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + jQuery(this).attr("value") + "\""; } else { multivalue_facet_queryphrase_local += "\"" + jQuery(this).attr("value") + "\"" ; } }); return multivalue_facet_queryphrase_local; } function returnSelectedYearCheckboxes() { var multivalue_facet_queryphrase_local = ""; jQuery(".yearCheckbox:checked").each(function(){ if (multivalue_facet_queryphrase_local.length > 0) { multivalue_facet_queryphrase_local += " OR \"" + jQuery(this).attr("value") + "\""; } else { multivalue_facet_queryphrase_local += "[" + jQuery(this).attr("value") + " " + jQuery(this).attr("value") + "%2B1YEAR]" ; } }); return multivalue_facet_queryphrase_local; } /* //site search */ function loadSitesearchTaxonomyInstitutionsData(data) { jQuery( "#sitesearchInstitution" ).append("

"); var facetArray = data.facet_counts.facet_fields.sm_vid_Institutions; // facetArray is even=facet name, odd=facet count for (let i = 0; i < facetArray.length; i++) { if ((i % 2) == 1) { jQuery( "#sitesearchInstitution" ).append("

"); } } } function loadSitesearchTaxonomyProcurementTypeData(data) { jQuery( "#sitesearchProcurementType" ).append("

"); var facetArray = data.facet_counts.facet_fields.sm_vid_Procurement_Type; // facetArray is even=facet name, odd=facet count for (let i = 0; i < facetArray.length; i++) { if ((i % 2) == 1) { jQuery( "#sitesearchProcurementType" ).append("

"); } } } function loadSitesearchDrupalTaxonomyCountriesData(data) { drupalTaxonomyCountriesData = data; } function loadSitesearchDrupalTaxonomySectorsData(data) { drupalTaxonomySectorsData = data; } function returnSitesearchInstitutionSelected() { return jQuery('#sitesearchInstitution').find(":selected").val(); } function returnSitesearchProcurementTypeSelected() { return jQuery('#sitesearchProcurementType').find(":selected").val(); } function returnSitesearchBundleSelected() { return jQuery('#bundle').find(":selected").val(); } function processTitleSelection() { if (Drupal.settings.authorizedUser == 0) { alert(alertMsg); } } function processFavoriteToggle(favorite_id, nid, favorite_bool) { if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { jQuery(".sitesearch_results_area").addClass("loading"); var favoritePath = "create-favorite"; var removeStar = "fa-star-o"; var addStar = "fa-star"; if (favorite_bool == 0) { favoritePath = "remove-favorite"; removeStar = "fa-star"; addStar = "fa-star-o"; } jQuery.ajax({ url: Drupal.settings.basePath + favoritePath + "/" + nid, type: 'POST', dataType: 'json', error: function (XMLHttpRequest, textStatus, errorThrown) { // console.log(JSON.stringify(XMLHttpRequest)); // console.log(JSON.stringify(textStatus)); // console.log(JSON.stringify(errorThrown)); alert("Sorry, we encountered a technical issue while saving your search."); }, success: function (data) { // console.log(data); // re-load favorites jQuery.ajax({ url: "/load-favorites", type: 'GET', dataType: 'json', success: function(data) { // console.log(data); favoritesAjaxArray = data; submitFedSitesearch(jQuery("#sitesearchInput").val(), 0, returnSitesearchBundleSelected(), returnSelectedInstitutionCheckboxes(), returnSelectedProcurementTypeCheckboxes(), returnSelectedCountryCheckboxes(), returnSelectedSectorCheckboxes(), returnSelectedLanguageCheckboxes(), returnSelectedNoticeTypeCheckboxes(), jQuery("#ts_field_project_nameInput").val(), jQuery("#labelInput").val(), jQuery("#sm_field_db_ref_no_Input").val(), jQuery("#sm_field_loan_no_Input").val(), jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(), jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(), jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(), returnSelectedSortTypeButton(), returnSelectedSortOrderButton(), returnSelectedStatusCheckboxes(), returnSelectedIndividualConsultingCheckboxes() ); }, error: function(data) { } }); // /load favorites } }); } } function processFavoriteToggleNodePage(favorite_id, nid, favorite_bool) { if (Drupal.settings.authorizedUser == 0) { jQuery(this).prop('checked', false); alert(alertMsg); } else { jQuery( "#favorite_text" ).html( '

' ); var favoritePath = "create-favorite"; var removeStar = "fa-star-o"; var addStar = "fa-star"; if (favorite_bool == 0) { favoritePath = "remove-favorite"; removeStar = "fa-star"; addStar = "fa-star-o"; } jQuery.ajax({ url: Drupal.settings.basePath + favoritePath + "/" + nid, type: 'POST', dataType: 'json', error: function (XMLHttpRequest, textStatus, errorThrown) { // console.log(JSON.stringify(XMLHttpRequest)); // console.log(JSON.stringify(textStatus)); // console.log(JSON.stringify(errorThrown)); alert("Sorry, we encountered a technical issue while saving your search."); }, success: function (data) { // console.log(data); // default add here favorite_text = "

"; // favorite_text = "default favorite text"; // re-load favorites jQuery.ajax({ url: "/load-favorites", type: 'GET', dataType: 'json', success: function(data) { // console.log(data); favoritesAjaxArray = data; if (favoritesAjaxArray != undefined) { jQuery.each(favoritesAjaxArray.nodes,function(i){ if (favoritesAjaxArray.nodes[i].node.entity_nid == nid) { favorite_star_icon = "fa-star"; favorite_bool = 0; // remove the favorite, not the underlying content toggle_id = favoritesAjaxArray.nodes[i].node.favorite_nid; favorite_text = "

"; } }); } jQuery("#favorite_text").html(favorite_text); }, error: function(data) { } }); // /load favorites } }); } } function toggleCountriesRegion(currentRegionId) { jQuery("#" + currentRegionId + "Indicator").toggleClass('fa-minus fa-plus'); } function resetFedSitesearch() { // clear all presets institutionButtonsSelectionArray = []; countryButtonsSelectionArray = []; procurementTypeButtonsSelectionArray = []; languageButtonsSelectionArray = []; noticeTypeButtonsSelectionArray = []; sectorButtonsSelectionArray = []; statusButtonsSelectionArray = []; individualConsultingButtonsSelectionArray = []; jQuery("#sitesearchInput").val(""); jQuery("#dm_field_deadlineFromInput").val(""); jQuery("#dm_field_deadlineFromInput").datepicker().val(""); jQuery("#dm_field_deadlineFromInput_actualDate").datepicker().val(""); jQuery("#dm_field_deadlineToInput").val(""); jQuery("#dm_field_deadlineToInput").datepicker().val(""); jQuery("#dm_field_deadlineToInput_actualDate").datepicker().val(""); jQuery("#ds_field_future_posting_dateFromInput").val(""); jQuery("#ds_field_future_posting_dateFromInput").datepicker().val(""); jQuery("#ds_field_future_posting_dateFromInput_actualDate").datepicker().val(""); jQuery("#ds_field_future_posting_dateToInput").val(""); jQuery("#ds_field_future_posting_dateToInput").datepicker().val(""); jQuery("#ds_field_future_posting_dateToInput_actualDate").datepicker().val(""); // reset sort select to the default value: ds_field_last_updated--desc jQuery("select#sort").val("ds_field_last_updated--desc"); submitFedSitesearch('', 0, returnSitesearchBundleSelected(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); }

You might also like

Latest Posts

Article information

Author: Annamae Dooley

Last Updated: 08/28/2022

Views: 6806

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.