var beansUrlParameter = function(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } } var getBaseConfig = function(urlFromRequest) { return { address: '', useGroundElevation: false, elevation: 0, canonicalUrl: urlFromRequest }; } var convertUnitsArr2 = function(address, unitsArr, hideMarkers) { var convertedArr = []; for (var i = 0; i < unitsArr.length; i++) { var bedText = (unitsArr[i].bed && unitsArr[i].bed !== '0') ? (unitsArr[i].bed + ' Bed') : 'Studio'; var td = new Date().toISOString().substring(0, 10); var as = (unitsArr[i].availability ? ('on ' + unitsArr[i].availability) : 'Now'); if (unitsArr[i].availability && unitsArr[i].availability <= td) { as = 'Now'; } var onPreviewData; if (unitsArr.floorplanImg) { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: 'img:' + unitsArr[i].floorplanImg }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } else { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } if (unitsArr[i].floorplan) { onPreviewData.push({ value: unitsArr[i].floorplan, icon: 'floorplan' }); } convertedArr.push({ address: address, unit: unitsArr[i].unit, options: { markers: { display: hideMarkers ? false : true }, poi: [ { name: "ALL", display: false }, { name: "CLUBHOUSE", display: true }, { name: "SWIMMINGPOOL", display: true }, { name: "OFFICE", display: true }, { name: "GYM", display: true }, { name: "MAILROOM", display: true }, { name: "LAUNDRY", display: true }, { name: "PLAYGROUND", display: true } ], onPreviewData: onPreviewData, onClickData: { name: unitsArr[i].unit ? unitsArr[i].unit.replaceAll('||', ' - ') : '', bed: unitsArr[i].bed, bath: unitsArr[i].bath, sqft: unitsArr[i].sqft, rent: unitsArr[i].rent, // floorplan: unitsArr[i].floorplan, floorplanImg: unitsArr[i].floorplanImg, availability: unitsArr[i].availability, link: unitsArr[i].link ? unitsArr[i].link.replaceAll('&', '&') : '' } } }); } return convertedArr; } var convertUnitsArr = function(config, unitsArr, hideMarkers, skipSort) { var addressAndUnitWithOptions; if (unitsArr.length === 0) { unitsArr.push({ unit: '' }); addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); addressAndUnitWithOptions[0].isPlaceHolder = true; } else { if (!skipSort) { unitsArr.sort((a, b) => { var aa = a.unit ? a.unit : ''; var bb = b.unit ? b.unit : ''; return aa.localeCompare(bb); }); } addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); } if (config.unitShapeConfig) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { addressAndUnitWithOptions[i].options.unitShape = config.unitShapeConfig(addressAndUnitWithOptions[i]); } } if (config.poi) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { for (var j = 0; j < config.poi.length; j++) { addressAndUnitWithOptions[i].options.poi.push(config.poi[j]); } } } return addressAndUnitWithOptions; } var commonImmersives = [ { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/0", elevationInfo: { mode: "absolute-height", offset: 0.1, }, opacity: 0.5, immersiveType: 'trees', renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Apricot", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 6, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/PrunusArmeniaca.glb" } } ] } }, { value: "Mountain Mahogany", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 2, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/CercocarpusMontanus.glb" } } ] } }, { value: "Rose", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 2, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/RosaGrandiflora.glb" } } ] } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/1", elevationInfo: { mode: "absolute-height", offset: 0.2, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Walkway", symbol: { type: "line-3d", symbolLayers: [ { type: "path", profile: "quad", material: { color: "#fcf5de" }, width: 2, // the width in m height: 0.3, // the height in m profileRotation: "heading" } ] // type: "simple-line", // width: 16, // color: "#aaaaaa" } }, { value: "Road", symbol: { type: "line-3d", symbolLayers: [ { type: "path", profile: "quad", material: { color: "#aaaaaa" }, width: 6, // the width in m height: 0.4, // the height in m profileRotation: "heading" } ] } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 0.1, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Lawn", symbol: { type: "simple-fill", outline: { width: 0 }, color: "rgba(178, 195, 136, 0.35)" } }, { value: "Concrete", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#CCCCCC" } }, { value: "Mulch", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#DBCEA2" } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 0.2, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Water", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#a5c2d1" } } ] }, isFeature: true }, ]; var getDisplayOptions = function( config, unitShape_, // Default shape selectedUnitShape_, // Selected shape selectableUnitShape_, // Selectable shape hoverUnitShape_ ) { return { propertyAddress: config.address, offsetGroundElevation: config.elevation, useGroundElevation: config.useGroundElevation, filters: config.filters, hideBeansCard: config.hideBeansCard, standaloneFilters: config.standaloneFilters, overrideHeight: config.overrideHeight, amenityPopupHeight: config.amenityPopupHeight, iconSizeMultiplier: config.iconSizeMultiplier, showUnitList: true, showUnitShape: true, outsideButtons: true, showDirections: false, showPath: false, propertyId: config.propertyId, propertyIdUrl: config.propertyIdUrl, pricing: config.pricing, showPricingAsDropdown: config.showPricingAsDropdown, colorsConfig: config.colorsConfig, camera: config.camera, mobileCamera: config.mobileCamera, renameAmenities: config.renameAmenities ? config.renameAmenities : null, shadowModeUnitShape: config.shadowModeUnitShape ? config.shadowModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborModeUnitShape: config.neighborModeUnitShape ? config.neighborModeUnitShape : { fillColor: '#D8D7D4', fillOpacity: 1.0, }, unitShape: config.unitShape ? config.unitShape : { fillColor: '#DDE3E0', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 0.5, strokeColor: '#000000', ...unitShape_ }, selectedUnitShape: config.selectedUnitShape ? config.selectedUnitShape : { fillColor: '#A6671D', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectedUnitShape_ }, selectableUnitShape: config.selectableUnitShape ? config.selectableUnitShape : { fillColor: '#24453E', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectableUnitShape_ }, satelliteModeUnitShape: config.satelliteModeUnitShape ? config.satelliteModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborShape: config.neighborShape, immersiveModeUnitShape: config.immersiveModeUnitShape, poiShape: config.poiShape, hoverUnitShape: hoverUnitShape_ ? hoverUnitShape_ : null, }; } var renderWithUnits = function(be1, renderType, config, address, unitsArr) { var addressAndUnitWithOptions = convertUnitsArr(config, unitsArr, true); if (!renderType || renderType.toLowerCase() === '3d') { var displayOptions = getDisplayOptions( config, { fillColor: '#EAD6C3', fillOpacity: 0.2, strokeWeight: 0.5, strokeOpacity: 0.2, strokeColor: '#000000', }, // Default color { fillColor: '#CDA349', }, // Selected color { fillColor: '#3F1F08', } // Selectable color ); be1.render( "body-inner-1", "bf141afe9917482:3030303233393234663239393462626338373235", addressAndUnitWithOptions, { hideNavigateButton: true, hideMyLocationButton: true }, { beansMapType: 'ESRI', initialMap: 'STREET', prettyLayer: config.prettyLayer ? config.prettyLayer : '', // "https://basemaps.arcgis.com/arcgis/rest/services/OpenStreetMap_v2/VectorTileServer" modernButtons: true, modernBeansCard: displayOptions.hideBeansCard ? false : true, outsideButtons: true, showCompass: true, showFullScreenMode: false, showNeighbors: false, showPOIButton: true, showSeparateFacilitiesCard: true, immersiveConfig: config.immersiveConfig, showImmersive: config.showImmersive, showImmersiveBalloons: config.showImmersiveBalloons, showImmersiveLight: config.showImmersiveLight, showImmersiveOnLoad: config.showImmersiveOnLoad, overrideBaseHeightFn: config.overrideBaseHeightFn, overrideHeight: config.overrideHeight ? config.overrideHeight : 0, overrideHeightFn: config.overrideHeightFn, renameAmenities: config.renameAmenities ? config.renameAmenities : null, poiShape: config.poiShape, initialTilt: 30, initialZ: 400, initialHeading: 270, initialPosition: { address: address }, show2DButton: true, event2D: () => { document.getElementById('body-inner-2').style.visibility = 'visible'; document.getElementById('body-inner-1').style.visibility = 'hidden'; }, ...displayOptions } ); } else { config.unitShape = null; var displayOptions = getDisplayOptions( config, { fillColor: '#FFFFFF', fillOpacity: 1.0, strokeWeight: 0.5, strokeOpacity: 1.0, strokeColor: '#000000' }, // Default color { fillColor: '#CDA349', }, // Selected color { fillColor: '#3F1F08', } // Selectable color ); if (displayOptions.unitShape) { displayOptions.unitShape.fillOpacity = 1.0; } be1.render( "body-inner-2", "bf141afe9917482:3030303233393234663239393462626338373235", addressAndUnitWithOptions, { hideNavigateButton: true, hideMyLocationButton: true }, { initialMap: "STREET", modernBeansCard: displayOptions.hideBeansCard ? false : true, hideFloorSelector: false, hideRotateControl: true, hideSatelliteButton: true, hideShadow: true, outsideButtons: true, modernButtons: true, showNeighbors: false, showPOIButton: false, showSeparateFacilitiesCard: true, showNumbers: true, numbersConfig: config.numbersConfig, showBuildingShape: config.showBuildingShape, backgroundImage: config.backgroundImage, show3DButton: true, event3D: () => { document.getElementById('body-inner-2').style.visibility = 'hidden'; document.getElementById('body-inner-1').style.visibility = 'visible'; }, unitsToExclude: config.unitsToExclude, ...displayOptions } ); } }; var BeansGoldenBear = function() { }; BeansGoldenBear.prototype.getConfigFromUrl = function(urlFromRequest) { var canonicalUrl = urlFromRequest ? urlFromRequest : window.location.hostname; if (beansUrlParameter('canonicalUrl')) { canonicalUrl = beansUrlParameter('canonicalUrl'); } var baseConfig = getBaseConfig(canonicalUrl); var config = {}; config["www.liveatmontereymanor.com"] = { isEntrataData: true, propertyId: "1301512", entrataDomain: "cmsmultifamily", camera: {tilt: 62.074291992718955, heading: 23.755718950822565, position: {x: -106.51310883891051, y: 35.08454892925609, z: 177.74946448765695}}, address: "12201 Lomas NE Blvd, Albuquerque, NM", }; config["www.liveatriverrockapartments.com"] = { isEntrataData: true, propertyId: "1301513", entrataDomain: "cmsmultifamily", camera: {tilt: 55.19228531347064, heading: 347.2009568464696, position: {x: -106.51047851175944, y: 35.085359362675746, z: 136.89995946735144}}, address: "12301 Lomas NE Blvd, Albuquerque, NM", }; config["www.thirteen20apts.com"] = { isEntrataData: true, propertyId: "1301499", entrataDomain: "cmsmultifamily", camera: {tilt: 66.40987716194928, heading: 25.320396307615066, position: {x: -104.75406952453498, y: 38.85054044034512, z: 61.45106707699597}}, address: "1320 Potter Dr, Colorado Springs, CO", }; config["www.liveattiburon.com"] = { isEntrataData: true, propertyId: "1301501", entrataDomain: "cmsmultifamily", camera: {tilt: 65.30832333571452, heading: 34.40442505851643, position: {x: -104.75444566824606, y: 38.85112643589071, z: 80.73763041105121}}, address: "1330 Potter Dr, Colorado Springs, CO", }; config["www.palazzoapartments.com"] = { isEntrataData: true, propertyId: "1301511", entrataDomain: "cmsmultifamily", camera: {tilt: 42.90296681929314, heading: 165.8493029012406, position: {x: -106.49200746639119, y: 35.080357369127945, z: 199.57106131501496}}, address: "14124 Copper NE Ave, Albuquerque, NM", }; config["www.livevillagesatwoodmen.com"] = { isEntrataData: true, propertyId: "1301502", entrataDomain: "cmsmultifamily", camera: {tilt: 59.95735369477555, heading: 244.922731533559, position: {x: -104.79119711601787, y: 38.932456327311066, z: 156.3545167222619}}, address: "1629 E Woodmen Rd, Colorado Springs, CO", }; config["www.liveatlelaray.com"] = { isEntrataData: true, propertyId: "1301500", entrataDomain: "cmsmultifamily", camera: {tilt: 55.93140756952295, heading: 32.86641409155717, position: {x: -104.78981441015787, y: 38.85585710316999, z: 71.65806057211012}}, address: "2115 Lelaray St, Colorado Springs, CO", }; config["www.marqueevillageapartments.com"] = { isEntrataData: true, propertyId: "1301508", entrataDomain: "cmsmultifamily", camera: {tilt: 49.98944346183216, heading: 358.3555570306141, position: {x: -106.63135248212934, y: 35.08151560367682, z: 181.242242324166}}, address: "230 Spruce NE St, Albuquerque, NM", }; config["www.pinelaneapts.com"] = { isEntrataData: true, propertyId: "1301510", entrataDomain: "cmsmultifamily", camera: {tilt: 59.22069325336695, heading: 286.1427276745178, position: {x: -106.52177885111134, y: 35.119283034082095, z: 134.83040180243552}}, address: "3300 Morris NE St, Albuquerque, NM", }; config["www.liveaustinbluffs.com"] = { isEntrataData: true, propertyId: "1301497", entrataDomain: "cmsmultifamily", camera: {tilt: 62.77580079629813, heading: 157.427316817446, position: {x: -104.76325722207106, y: 38.89829126781405, z: 290.2252526022494}}, address: "3555 Westwood Blvd, Colorado Springs, CO", }; config["www.featherstoneapartmenthomes.com"] = { isEntrataData: true, propertyId: "1301503", entrataDomain: "cmsmultifamily", camera: {tilt: 53.22612319580364, heading: 163.2594990348781, position: {x: -104.7555941970243, y: 38.886883153355164, z: 111.8888994064182}}, address: "3807 Half Turn Rd, Colorado Springs, CO", }; config["www.thetaapartments.com"] = { isEntrataData: true, propertyId: "1301514", entrataDomain: "cmsmultifamily", camera: {tilt: 48.53490129317573, heading: 86.68276002220382, position: {x: -106.60818250241788, y: 35.12521656508589, z: 187.83126953151077}}, address: "3900 Tulane NE Dr, Albuquerque, NM", }; config["www.vistasatcitadel.com"] = { isEntrataData: true, propertyId: "1301498", entrataDomain: "cmsmultifamily", camera: {tilt: 58.8984732196439, heading: 190.9708689160115, position: {x: -104.75386148893759, y: 38.83641882262962, z: 132.9240575665608}}, address: "3955 E Bijou St, Colorado Springs, CO", }; config["www.elevateaptsco.com"] = { isEntrataData: true, propertyId: "1301506", entrataDomain: "cmsmultifamily", camera: {tilt: 67.74324480140189, heading: 328.8826921367458, position: {x: -104.83249654256369, y: 38.811988643339994, z: 132.60394262056798}}, address: "402 Crestone Ln, Colorado Springs, CO", }; config["www.stratusaptsco.com"] = { isEntrataData: true, propertyId: "1301507", entrataDomain: "cmsmultifamily", camera: {tilt: 62.285914139237825, heading: 134.39207132895686, position: {x: -104.75521759282128, y: 38.827544489445316, z: 250.94976588711143}}, address: "4255 Airport Rd, Colorado Springs, CO", }; config["www.spaintownhomes.com"] = { isEntrataData: true, propertyId: "1301515", entrataDomain: "cmsmultifamily", camera: {tilt: 63.83341661147728, heading: 285.43364077748294, position: {x: -106.53111207039561, y: 35.13748421941615, z: 134.2017335947603}}, address: "5009 El Corte Miramar NE, Albuquerque, NM", }; config["www.chelseavillageapartments.com"] = { isEntrataData: true, propertyId: "1301509", entrataDomain: "cmsmultifamily", camera: {tilt: 41.4415658916393, heading: 347.41559454277524, position: {x: -106.56524658588708, y: 35.12668472636796, z: 297.31394724547863}}, address: "7100 Natalie NE Ave, Albuquerque, NM", }; config["www.broadmoorparkterrace.com"] = { isEntrataData: true, propertyId: "1301505", entrataDomain: "cmsmultifamily", camera: {tilt: 63.74167726605204, heading: 302.69075417292487, position: {x: -104.84329984894985, y: 38.808633250066244, z: 78.69217122998089}}, address: "920 Arcturus Dr, Colorado Springs, CO", }; config["www.broadmoorparktower.com"] = { isEntrataData: true, propertyId: "1301504", entrataDomain: "cmsmultifamily", camera: {tilt: 65.51631753406274, heading: 45.20388104231103, position: {x: -104.84626274365237, y: 38.807660621726306, z: 59.25649211369455}}, address: "929 Arcturus Dr, Colorado Springs, CO", }; if (config[canonicalUrl]) { return {...baseConfig, ...config[canonicalUrl]}; } return baseConfig; } BeansGoldenBear.prototype.getFloorPlans = function(callback) { var so = this; if (beansUrlParameter('getData') === 'true') { } } BeansGoldenBear.prototype.checkAndGetData = function() { var so = this; if (beansUrlParameter('getData') === 'true') { so.getFloorPlans(); } } BeansGoldenBear.prototype.render = function(be1, urlFromRequest, renderType) { var so = this; var config = so.getConfigFromUrl(urlFromRequest); var address = config.address; if (config.unitsArr) { renderWithUnits(be1, renderType, config, address, config.unitsArr); } else if (config.isEntrataData) { fetch('https://www.beans.ai/mapswidget/client/entrata?dom=' + config.entrataDomain + '&propertyId=' + config.propertyId, { headers: { 'Content-Type': 'APPLICATION/JSON; CHARSET=UTF-8', 'X-Api-Key': '28f71a3b-0925-41be-b71a-3b092501be14' } } ) .then(response => response.json()) .then(json => { var floorplans = {}; if (json.response && json.response.result && json.response.result.Properties) { for (var i in json.response.result.Properties.Property[0].Floorplans.Floorplan) { var fp = json.response.result.Properties.Property[0].Floorplans.Floorplan[i]; var val = '' + fp.Identification.IDValue; var beds = 0; var baths = 0; var sqft = 0; for (var j in fp.Room) { var rm = fp.Room[j]; if (rm['@attributes']['RoomType'] === 'Bedroom') { beds = rm.Count; } if (rm['@attributes']['RoomType'] === 'Bathroom') { baths = rm.Count; } } if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Min) { sqft = fp.SquareFeet['@attributes'].Min; } else if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Max) { sqft = fp.SquareFeet['@attributes'].Max; } else if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Avg) { sqft = fp.SquareFeet['@attributes'].Avg; } floorplans[val] = { beds: beds, baths: baths, sqft: sqft }; } } var unitsArr = []; if (!config.placeHolder && json.response && json.response.result && json.response.result.ILS_Units) { for (var i in json.response.result.ILS_Units.Unit) { var obj = json.response.result.ILS_Units.Unit[i]; if (!obj['@attributes']['Availability'] || obj['@attributes']['Availability'] !== 'Available') { continue; } var availability = 'Now'; if (obj['@attributes']['AvailableOn']) { availability = ' from ' + obj['@attributes']['AvailableOn']; } var pp = '' + obj['@attributes']['PropertyId']; var up = '' + obj['@attributes']['PropertyUnitId']; var fp = '' + obj['@attributes']['FloorplanId']; var beds = 0; var baths = 0; var sqft = 0; var rent = 0; if (obj.Rent && obj.Rent['@attributes'].MinRent) { rent = Number(obj.Rent['@attributes'].MinRent.replace(/[^0-9\.]/, '')); } else if (obj.Rent && obj.Rent['@attributes'].MaxRent) { rent = Number(obj.Rent['@attributes'].MaxRent.replace(/[^0-9\.]/, '')); } if (floorplans[fp]) { beds = floorplans[fp].beds; baths = floorplans[fp].baths; sqft = floorplans[fp].sqft; } var un = obj['@attributes']['UnitNumber']; if (obj['@attributes']['BuildingName']) { if (obj['@attributes']['BuildingName'].indexOf(' ') !== -1) { un = obj['@attributes']['BuildingName'] + '||' + un; } else { un = obj['@attributes']['BuildingName'] + '-' + un; } } unitsArr.push({ unit: un, bed: beds, bath: baths, sqft: sqft, availability: availability, rent: rent, link: 'https://' + config.canonicalUrl + '/Apartments/module/application_authentication/popup/false/kill_session/1/property[id]/%20' + pp + '/property_floorplan[id]/' + fp + '/unit_space[id]/' + up + '/show_in_popup/false/from_check_availability/1' }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isAtlanticData) { fetch('https://www.beans.ai/mapswidget/client/atlantic-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; for (var i in json) { if (i.indexOf(config.canonicalUrl) !== -1) { var x = JSON.parse(json[i]); for (var j = 0; j < x.length; j++) { if (!x[j].units || x[j].units.length === 0) { continue; } for (var k = 0; k < x[j].units.length; k++) { var av = x[j].units[k].available; if (av.indexOf('/') !== -1) { var m = String(av.split('/')[0]).padStart(2, '0'); var d = String(av.split('/')[1]).padStart(2, '0'); var y = av.split('/')[2]; av = y + '-' + m + '-' + d; } var unit = x[j].units[k]['unit']; var beds = x[j].beds ? x[j].beds : 0; var baths = x[j].baths ? x[j].baths : 0; var sqft = x[j].units[k]['area']; var rent = x[j].units[k]['rent']; var floorplan = x[j].name; var floorplanImg = x[j].img ? x[j].img : ''; var avail = av; var link = config.rentcafeLink + '&FloorPlanID=' + x[j].id + '&UnitID=' + x[j].units[k].id + '&MoveInDate=' + x[j].units[k].available; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, floorplan: floorplan, link: link, floorplanImg: floorplanImg, availability: avail}); } } } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isYardiData) { fetch('https://www.beans.ai/mapswidget/client/' + config.yardiDomain + '-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; for (var i in json) { if (i.indexOf(config.canonicalUrl) !== -1) { var x = JSON.parse(json[i]); for (var j = 0; j < x.length; j++) { for (var k = 0; k < x[j].units.length; k++) { var unit = x[j].units[k]['unit']; var unitData = x[j].units[k]['data']; var y = /.*'(.*)', '(.*)', '(.*)', '(.*)', '(.*)', '(.*)'.*/.exec(unitData); var beds = x[j].beds ? x[j].beds : 0; var baths = x[j].baths ? x[j].baths : 0; var sqft = 0; var rent = 0; floorplanImg = x[j].img ? x[j].img : ''; if (y) { sqft = Number(y[3]); rent = Number(y[4]); } var avail = ''; if (x[j].units[k]['link']) { var ix = x[j].units[k]['link'].lastIndexOf('='); if (ix !== -1) { avail = x[j].units[k]['link'].substring(ix + 1); if (avail.indexOf('&') !== -1) { avail = avail.substring(0, avail.indexOf('&')); } } } if (address == '200 NW 2nd St, Waukee, IA' && avail) { monthAvail = Number(avail.split('/')[0]); var currentMonth = new Date().getMonth() + 1; if (monthAvail <= currentMonth) { unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: x[j].units[k]['link'] ,floorplanImg: floorplanImg, availability: avail}); } } else { unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: x[j].units[k]['link'] ,floorplanImg: floorplanImg, availability: avail}); } } } } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isTurboTenantData) { fetch('https://www.beans.ai/mapswidget/client/graphqlturbo?property_id=' + config.propertyId) .then(response => response.json()) .then(json => { var unitsArr = []; if (json.data && json.data.viewer && json.data.viewer.ownerListings) { for (var i in json.data.viewer && json.data.viewer.ownerListings) { var obj = json.data.viewer.ownerListings[i]; var unit = obj.unit; var address = obj.address; if (address.indexOf(' ') !== -1) { address = address.split(' ')[0]; } if (address.indexOf('Rudder') !== -1) { address = address + 'R'; } unit = address + '-' + unit; unitsArr.push({ unit: unit, bed: obj.details.property_details.bedrooms, bath: obj.details.property_details.bathrooms, sqft: obj.details.property_details.square_feet, availability: 'Now', rent: obj.rent_amount, link: 'https://renter.turbotenant.com/applications/' + obj.id }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isGraphqlData) { fetch('https://www.beans.ai/mapswidget/client/graphql.php?property_id=' + config.canonicalUrl + '&location=' + config.locationUrl + '&force=' + (beansUrlParameter('force') ? beansUrlParameter('force') : '')) .then(response => response.json()) .then(json => { if (json.data && json.data.apartmentComplex && json.data.apartmentComplex.floorplans) { var floorplans = []; for (var i = 0; i < json.data.apartmentComplex.floorplans.length; i++) { floorplans.push(json.data.apartmentComplex.floorplans[i]); } var unitsArr = []; var proms = []; for (var i = 0; i < floorplans.length; i++) { const floorplan = floorplans[i]; proms.push( fetch('https://www.beans.ai/mapswidget/client/graphqlfp.php?property_id=' + config.canonicalUrl + '&location=' + config.locationUrl + '&floorplan_id=' + floorplan.id + '&force=' + (beansUrlParameter('force') ? beansUrlParameter('force') : '')) .then(response => response.json()) .then(jsonI => { if (jsonI.data && jsonI.data.units) { for (var i = 0; i < jsonI.data.units.length; i++) { var unitObj = jsonI.data.units[i]; var lnk = unitObj.callToActions && unitObj.callToActions.length ? unitObj.callToActions[0].url : ''; lnk = lnk.replace('{widget.moveInDate.YYYY-MM-DD}', unitObj.availabilityDate ? unitObj.availabilityDate : ''); unitsArr.push({ unit: unitObj.name, bed: floorplan.beds, bath: floorplan.baths, floorplan: floorplan.name, sqft: unitObj.sqftDisplay ? Number(unitObj.sqftDisplay.replace(/[^0-9\.]/, '')) : floorplan.sqft, rent: unitObj.prices && unitObj.prices.length ? unitObj.prices[0].value : 0, availability: unitObj.availabilityDate ? unitObj.availabilityDate : '', link: lnk, floorplanImg: floorplan.imageUrl }); } } }) ); } Promise.all(proms).then((values) => { renderWithUnits(be1, renderType, config, address, unitsArr); }); } else { renderWithUnits(be1, renderType, config, address, []); } }); } else if (config.isAppfolioData) { fetch('https://www.beans.ai/mapswidget/client/appfolio.php?propertyId=' + config.propertyId + '&url=' + urlFromRequest) .then(response => response.json()) .then(json => { var unitsArr = []; for (var k = 0; k < json.values.length; k++) { var unit = json.values[k].data.address_address1; var beds = json.values[k].data.bedrooms; var baths = json.values[k].data.bathrooms; var sqft = json.values[k].data.square_feet; var rent = json.values[k].data.market_rent; var avail = json.values[k].data.available_date; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: '' ,floorplanImg: '', availability: avail}); } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isQuickbaseData) { fetch('https://www.beans.ai/mapswidget/client/perry-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; var x = json[config.propertyId]; if (x) { for (var j = 0; j < x.length; j++) { if (!x[j].Available) { continue; } var unit = x[j].Unit; var beds = x[j].Bedrooms ? x[j].Bedrooms : 0; var baths = x[j].Bathrooms ? x[j].Bathrooms : 0; var sqft = x[j].SqFt ? x[j].SqFt : 0; var rent = x[j].Rent ? Number(x[j].Rent.replace(',', '')) : 0; var floorplan = x[j].Model ? x[j].Model : ''; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: '' ,floorplan: floorplan, availability: ''}); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isGisData) { fetch('https://gis-server.beans.ai/arcgis/rest/services/Hosted/' + config.gisDomain + '/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&defaultSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnCentroid=false&timeReferenceUnknownClient=false&maxRecordCountFactor=&sqlFormat=none&resultType=&datumTransformation=&lodType=geohash&lod=&lodSR=&f=pjson') .then(response => response.json()) .then(json => { var unitsArr = []; if (json.features) { for (var i = 0; i < json.features.length; i++) { if (!config.addressList[json.features[i].attributes.address]) { continue; } if (json.features[i].attributes.availability !== 'Available') { continue; } var type = json.features[i].attributes.type ? json.features[i].attributes.type : ''; var bedrooms = 0; var bathrooms = 0; if (type === 'Studio') { bathrooms = 1; } else { var y = /.*([0-9+]) Bed.*/.exec(type); if (y) { bedrooms = Number(y[1]); } var z = /.*([0-9+]) Bath.*/.exec(type); if (z) { bathrooms = Number(z[1]); } } var unit = '' + json.features[i].attributes.unit; var bldg = '' + json.features[i].attributes.address.substring(0, json.features[i].attributes.address.indexOf(' ')); if (!config.skipBuildingNumberinSearch) { unit = bldg + '-' + unit; } var floorplan = json.features[i].attributes.floor_plan_name ? json.features[i].attributes.floor_plan_name : ''; floorplan = floorplan.trim(); var floorplanImg = ''; if (floorplan) { if (floorplan.toLowerCase() === 'ace' || floorplan.toLowerCase() === 'aviator' || floorplan.toLowerCase() === 'bandit' || floorplan.toLowerCase() === 'baron' || floorplan.toLowerCase() === 'captain' || floorplan.toLowerCase() === 'clipper' || floorplan.toLowerCase() === 'curve' || floorplan.toLowerCase() === 'lookout' || floorplan.toLowerCase() === 'traveler' || floorplan.toLowerCase() === 'surge' || floorplan.toLowerCase() === 'alley-oop' || floorplan.toLowerCase() === 'assist' || floorplan.toLowerCase() === 'baseline' || floorplan.toLowerCase() === 'fast break' || floorplan.toLowerCase() === 'free throw' || floorplan.toLowerCase() === 'shot clock' || floorplan.toLowerCase() === 'slam dunk' || floorplan.toLowerCase() === 'swish' || floorplan.toLowerCase() === 'tip off') { floorplanImg = 'https://www.beans.ai/mapswidget/client/mfpro-images/' + floorplan.toLowerCase() + '.png'; } } var link = json.features[i].attributes.learn_more__url ? json.features[i].attributes.learn_more__url : ''; unitsArr.push({ unit: unit, bed: bedrooms, bath: bathrooms ? bathrooms : 1, sqft: json.features[i].attributes.sqft ? json.features[i].attributes.sqft : 0, rent: json.features[i].attributes.price ? json.features[i].attributes.price : 0, floorplan: floorplan, floorplanImg: floorplanImg, link: link }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.knockrentalPropertyId) { fetch('https://doorway-api.knockrentals.com/v1/property/' + config.knockrentalPropertyId + '/units') .then(response => response.json()) .then(jsonKnock => { var buildings = {}; if (jsonKnock.units_data && jsonKnock.units_data.buildings) { for (var i = 0; i < jsonKnock.units_data.buildings.length; i++) { var unitObj = jsonKnock.units_data.buildings[i]; if (!unitObj.name || !unitObj.id) { continue; } buildings[unitObj.id] = jsonKnock.units_data.buildings[i]; } } var layouts = {}; if (jsonKnock.units_data && jsonKnock.units_data.layouts) { for (var i = 0; i < jsonKnock.units_data.layouts.length; i++) { var unitObj = jsonKnock.units_data.layouts[i]; if (!unitObj.name || !unitObj.id) { continue; } layouts[unitObj.id] = jsonKnock.units_data.layouts[i]; } } var unitsArr = []; if (jsonKnock.units_data && jsonKnock.units_data.units) { for (var i = 0; i < jsonKnock.units_data.units.length; i++) { var unitObj = jsonKnock.units_data.units[i]; if (!unitObj.available) { continue; } var unit = unitObj.name; if (unitObj.buildingId && buildings[unitObj.buildingId] && buildings[unitObj.buildingId].name) { unit = buildings[unitObj.buildingId].name + '-' + unit; } // if (!config.unitsData[unit]) { // continue; // } var beds = unitObj.bedrooms; var baths = unitObj.bathrooms; var sqft = unitObj.area; var rent = unitObj.displayPrice; var link = 'https://' + config.realpagePropertyId + '.onlineleasing.realpage.com/?UnitId='; var floorplan = unitObj.layoutName; var floorplanImg = layouts[unitObj.layoutId].img; var avail = unitObj.availableOn; unitsArr.push({unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: link, floorplan: floorplan, floorplanImg: floorplanImg, availability: avail}); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else { renderWithUnits(be1, renderType, config, address, []); } }