//(function () { angular.module('MobileWebLogistics') .service('localCustom', function () { var self = this; //====== modal images this.getImages = function ($scope, $modal, wlFactory, imageLink, i) { var isParcelImg = true; var parcelImgUrl = ''; var parcelUrl = $scope.thumbnailUrl.replace("Thumbnails", "Parcels"); if (i == 1) { $scope.parcelImages = []; $scope.parcelImages.push(imageLink); //add first image parcelImgUrl = parcelUrl + imageLink; //https://s3.amazonaws.com/timmons-weblogistics/Gloucester/Parcels/0662-52-0237_1.jpg } wlFactory.imageExists($scope, parcelImgUrl, function (exists) { isParcelImg = exists; if (isParcelImg == true) { if (i > 1 && $scope.parcelImages.indexOf(imageLink + " img" + i) == -1) { $scope.parcelImages.push(imageLink + " img" + i); } i++; self.getImages($scope, $modal, wlFactory, imageLink, i) } else { if ($scope.openImageDelay == 0) { setTimeout(function () { self.openImage($scope, $modal); }, 400); } setTimeout(function () { $scope.openImageDelay = 0; }, 1000); } }); } this.openImage = function ($scope, $modal, event) { if ($scope.openImageDelay == 0) { $scope.openImageDelay = 1; var modalInstance = $modal.open({ templateUrl: 'templates/imageModal.html', controller: 'ImageController', scope: $scope }); } } //======endof modal images //======custom create report var pdf, parcelImg, isParcelImg, parcelMap, isParcelMap, imgwidth1, imgwidth2, imgwidth3; var imgheight1, imgheight2, imgheight3; var availSpace = 270; var defaultTop = 28; var page = 1; this.createPDF = function ($scope, parcelImgUrl) { parcelImg = new Image(); parcelImg.setAttribute('crossOrigin', 'anonymous'); setTimeout(function () { var img1; pdf = new jsPDF('portrait', 'mm', 'letter', true); var margins = { top: 15, bottom: 60, left: 20, width: 520 }; self.addTable1($scope); }, 500); } this.addHeader = function ($scope) { try { pdf.addImage('headerImg', 'PNG', 15, 8, 71.7 * 0.861, 22.49 * 0.861); } catch (err) { pdf.addImage($scope.headerData, 'PNG', 15, 8, 71.7 * 0.861, 22.49 * 0.861, 'headerImg'); } pdf.setFont("arial"); pdf.setTextColor(0, 0, 0); pdf.setFontSize(10); pdf.textEx($scope.pdfHeaderTxt1, 194, 18, 'right', 'middle'); pdf.textEx($scope.pdfHeaderTxt2, 193, 23, 'right', 'middle'); pdf.setLineWidth(0.4); pdf.setDrawColor(0, 0, 0); pdf.line(37, 25, 198, 25); } this.addFooter = function (pidtxt, pid, page) { var footerText1 = "This information is provided for convenience only. No representation whatsoever is made as to accuracy and this information is not a replacement for a title examination and/or consultation with the Zoning Office and should not be relied upon for any purpose." pdf.setFont("BookAntiqua"); pdf.setFontStyle("italic"); pdf.setLineWidth(50); pdf.setTextColor(0, 0, 0); pdf.setFontSize(8); var splitTitle = pdf.splitTextToSize(footerText1, 180); pdf.text(18, 250, splitTitle); var footerText2 = "USE AT YOUR OWN RISK." pdf.setFont("times"); pdf.setFontStyle("italic"); pdf.setTextColor(0, 0, 0); pdf.setFontSize(9); pdf.text(18, 260, footerText2); var footerText3 = "For more information, please contact the Commissioner of the Revenue at 804.785.5976." pdf.setFont("times"); pdf.setFontStyle("italic"); pdf.setTextColor(0, 0, 0); pdf.setFontSize(8); pdf.text(18, 265, footerText3); pdf.text(183, 265, page + ' | Page'); } this.addImages = function ($scope) { if ($scope.propertyImg == 'false') { isParcelImg = false; } if (isParcelImg == true) { var imgLoc; var j; self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); page += 1; imgLoc = 30; pdf.addPage(); self.addHeader($scope); for (j = 0; j < $scope.reportImages.length; j++) { var imgW = $scope.reportImages[j].width / ($scope.reportImages[j].width / 140); var imgH = $scope.reportImages[j].height / ($scope.reportImages[j].width / 140); if (imgLoc + imgH > availSpace) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); page += 1; imgLoc = 30; pdf.addPage(); self.addHeader($scope); } pdf.addImage($scope.reportImages[j], 'JPEG', 35, imgLoc, imgW, imgH, 'house' + j); imgLoc = imgLoc + imgH + 10; if ($scope.multipleReportImages != 'true') { j = 1000; } } self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); pdf.save('Parcel_report.pdf'); $("#pdfPreloaderContainer").removeClass("active"); page = 1; } else { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); pdf.save('Parcel_report.pdf'); $("#pdfPreloaderContainer").removeClass("active"); page = 1; } } var tblNum = 1; this.addTable1 = function ($scope) { self.addHeader($scope); pdf.setFont("arial"); pdf.setTextColor(80, 80, 80); pdf.setFontSize(16); pdf.text(17, 42, $("#propertyAddr").html()); html2canvas($("#reportBody > #reportTbl_1"), { onrendered: function (canvas1) { var imgData1 = canvas1.toDataURL('image/png'); imgwidth1 = canvas1.width * 0.227; imgheight1 = canvas1.height * 0.23; pdf.addImage(imgData1, 'PNG', 16, 45, imgwidth1, imgheight1); nextTblLoc = imgheight1 + 45; tblNum = 2; if (tblNum > $scope.numOfTable) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); pdf.save('Parcel_report.pdf'); pdfCt = 0; page = 1; $scope.pdfPage = 0; $("#pdfPreloaderContainer").removeClass("active"); } else { self.addAdditionalTable($scope); } } }); } this.addAdditionalTable = function ($scope) { html2canvas($("#reportBody > #reportTbl_" + tblNum), { onrendered: function (canvas2) { var imgData2 = canvas2.toDataURL('image/png'); imgwidth2 = canvas2.width * 0.227; imgheight2 = canvas2.height * 0.23; var context = canvas2.getContext('2d'); if (nextTblLoc + imgheight2 > availSpace) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); page += 1; $scope.pdfPage = page; $scope.$apply(); pdf.addPage(); self.addHeader($scope); nextTblLoc = defaultTop; pdf.addImage(imgData2, 'PNG', 16, nextTblLoc, imgwidth2, imgheight2); nextTblLoc += imgheight2; } else { pdf.addImage(imgData2, 'PNG', 16, nextTblLoc, imgwidth2, imgheight2); nextTblLoc = nextTblLoc + imgheight2; } tblNum += 1; canvas2.width = canvas2.width; context.clearRect(0, 0, canvas2.width, canvas2.height); imgData2 = ''; if (tblNum > $scope.numOfTable - 1) { if (tblNum > $scope.numOfTable) { if ($scope.numOfSubTable == undefined) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); pdf.save('Parcel_report.pdf'); pdfCt = 0; page = 1; $scope.pdfPage = 0; $("#pdfPreloaderContainer").removeClass("active"); } else { nextTblLoc += 2; self.addBuildingSubTables($scope, 0); } } else { nextTblLoc += 2; self.addValueSubTables($scope, 0); } } else { self.addAdditionalTable($scope); } } }); } var subTbl; var pdfCt = 0; this.addValueSubTables = function ($scope, index) { html2canvas($("#reportBody > #valueTblDiv > #valueTbl_" + index), { onrendered: function (canvas4) { pdf.setFont("arial"); pdf.setTextColor(80, 80, 80); pdf.setFontSize(8); var trElems = $("#valueTbl_" + index + " tr"); var tr, col1, col2; // TODO: clean up this logic if (nextTblLoc + 67.50 > availSpace) { subTbl = 1; self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); page += 1; $scope.pdfPage = page; $scope.$apply(); pdf.addPage(); self.addHeader($scope); nextTblLoc = defaultTop + 2; pdf.setFont("arial"); pdf.setTextColor(80, 80, 80); pdf.setFontSize(8); for (var r = 0; r < 13; r++) { tr = $(trElems).eq(r); col1 = $(tr).children("td").first(); col2 = $(col1).next(); pdf.text(18, nextTblLoc, $(col1).text()); pdf.text(130, nextTblLoc, $(col2).text()); nextTblLoc += 4; } nextTblLoc += 2; } else { for (var r = 0; r < 13; r++) { tr = $(trElems).eq(r); col1 = $(tr).children("td").first(); col2 = $(col1).next(); pdf.text(18, nextTblLoc, $(col1).text()); pdf.text(130, nextTblLoc, $(col2).text()); nextTblLoc += 4; } nextTblLoc += 2; } pdf.setLineWidth(0.3); pdf.setDrawColor(235, 235, 235); pdf.line(15, nextTblLoc, 198, nextTblLoc); nextTblLoc += 5; index += 1; if (index > $scope.numOfSubTable - 1) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); self.addAdditionalTable($scope); } else { self.addValueSubTables($scope, index); } } }); } this.addBuildingSubTables = function ($scope, index) { html2canvas($("#reportBody > #blgTblDiv > #blgTbl_" + index), { onrendered: function (canvas3) { pdf.setFont("arial"); pdf.setTextColor(80, 80, 80); pdf.setFontSize(8); if (nextTblLoc + 67.50 > availSpace) { subTbl = 1; self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); page += 1; $scope.pdfPage = page; $scope.$apply(); pdf.addPage(); self.addHeader($scope); nextTblLoc = defaultTop + 2; pdf.setFont("arial"); pdf.setTextColor(80, 80, 80); pdf.setFontSize(8); for (var r = 1; r <= 12; r++) { var cell1 = $("#reportBody > #blgTblDiv > #blgTbl_" + index + " #r" + r + "c1").html().replace('', '').replace('', ''); var cell1 = cell1.replace('', '').replace('', '').replace('&', '&'); var cell1 = cell1.split(":"); cell1[0] += ': ' var cell2 = $("#reportBody > #blgTblDiv > #blgTbl_" + index + " #r" + r + "c2").html().replace('', '').replace('', '').replace('&', '&'); var cell2 = cell2.replace('', ''); pdf.text(18, nextTblLoc, cell1[0]); var nextleft = 18 + pdf.getTextDimensions(cell1[0]).w * 0.35; pdf.text(nextleft, nextTblLoc, cell1[1]); pdf.text(130, nextTblLoc, cell2); nextTblLoc += 4; } nextTblLoc += 2; } else { for (var r = 1; r <= 12; r++) { var cell1 = $("#reportBody > #blgTblDiv > #blgTbl_" + index + " #r" + r + "c1").html().replace('', '').replace('', ''); var cell1 = cell1.replace('', '').replace('', '').replace('&', '&'); var cell1 = cell1.split(":"); cell1[0] += ': ' var cell2 = $("#reportBody > #blgTblDiv > #blgTbl_" + index + " #r" + r + "c2").html().replace('', '').replace('', '').replace('&', '&'); var cell2 = cell2.replace('', ''); pdf.text(18, nextTblLoc, cell1[0]); var nextleft = 18 + pdf.getTextDimensions(cell1[0]).w * 0.35; pdf.text(nextleft, nextTblLoc, cell1[1]); pdf.text(130, nextTblLoc, cell2); nextTblLoc += 4; } nextTblLoc += 2; } pdf.setLineWidth(0.3); pdf.setDrawColor(235, 235, 235); pdf.line(15, nextTblLoc, 198, nextTblLoc); nextTblLoc += 5; index += 1; if (index > $scope.numOfSubTable - 1) { self.addFooter($scope.parcelpdfID[0], $scope.selectedParcel[$scope.parcelpdfID[1]], page); pdf.save('Parcel_report.pdf'); pdfCt = 0; page = 1; $scope.pdfPage = 0; $scope.numOfSubTable = undefined; $("#pdfPreloaderContainer").removeClass("active"); } else { self.addBuildingSubTables($scope, index); } } }); } //======end of custom create report //======findRelatedRecords this.findRelatedRecords = function ($scope, OBJECTID) { var relatedTblQuery = new $scope.RelationshipQuery(); relatedTblQuery.outFields = ["*"]; relatedTblQuery.objectIds = [OBJECTID]; relatedTblQuery.relationshipId = '0'; //Assess_Building $scope.selectedParcelT0 = []; $scope.parcelLayer.queryRelatedFeatures(relatedTblQuery, function (relatedRecords) { if (relatedRecords[OBJECTID]) { $scope.relatedResult0 = relatedRecords[OBJECTID].features; for (var i = 0; i < $scope.relatedResult0.length; i++) { for (var key in $scope.relatedResult0[i].attributes) { var thisKey = $scope.relatedResult0[i].attributes[key.toString()]; $scope.relatedResult0[i].attributes[key.toString()] = $scope.formatParcelData(key, thisKey, $scope.relatedResult0[i].attributes[key.toString()]); } $scope.relatedResult0[i].attributes['index'] = i; $scope.selectedParcelT0.push($scope.relatedResult0[i].attributes); } $scope.numOfSubTable = $scope.selectedParcelT0.length; } $scope.$apply(); setTimeout($scope.myScroll2.refresh(), 300); setTimeout($scope.myScroll3.refresh(), 300); if (window.innerWidth < 651) { $scope.map.infoWindow.hide(); if ($scope.showPanel2 == true) { $("#panel1").removeClass("active"); $("#panel1").addClass("inactive"); //to hide iscroll of panel1 $("#panel2").addClass("active"); } else { $scope.hidePanel2(); } } else if (window.innerWidth > 650) { if ($scope.selDetailPanel != 'map' && $scope.selDetailPanel != 'm' && $scope.selDetailPanel != 'p1') { $scope.switchParcelDetails($scope.selDetailPanel); $("#detailPanels").addClass("active"); $("#panel1").addClass("active"); $("#panel1").removeClass("inactive"); if ($scope.selDetailPanel == 'adjoiner') { $scope.showAdjoiner = true; } $scope.showDetail(); setTimeout($scope.myScroll2.refresh(), 300); setTimeout($scope.myScroll3.refresh(), 300); } } $("#detailPreloaderContainer").removeClass("active"); $scope.$apply(); }); } //==========end of findRelatedRecords //========custom search this.search = function ($scope, fromTypeahead) { //searchFrame $scope.advSearch1 = false; $scope.advSearch2 = false; $scope.advSearch3 = false; $scope.advSearch4 = false; $("#searchFrame").collapse('hide'); $scope.closeDialog(); if ($scope.searchBtn == "submitSearchMap") { $scope.showMap(); $("#identifyPreloaderContainer").addClass("active"); } else { $scope.showList(); } var drawButtons = $("#drawTools > div"); for (var i = 0; i < drawButtons.length; i++) { if ($(drawButtons[i]).hasClass("selected")) { $("#openDrawTools").removeClass("active"); $("#drawTools").removeClass("active"); $("#drawTools .selected").removeClass("selected"); $("#drawTools .unselected").removeClass("unselected"); $scope.toolbar.deactivate(); } } $("#searchPreloaderContainer").addClass("active"); $("#listResults").addClass("inactive"); setTimeout(function () { $scope.thisSearchMode = $("#search1").hasClass("active"); $scope.queryTask = new $scope.QueryTask($scope.queryTaskUrl); $scope.query2.outFields = $scope.initParcelFields; $scope.query2.returnGeometry = true; var numQueryField = 1; $scope.thisTxtboxSearch = ""; $scope.queryStringDate = ""; $scope.queryStringPrice = ""; $scope.searchQueryString = ""; if ($("#search1").hasClass("active")) { if (fromTypeahead > 0) { $scope.thisTxtboxSearch = $("#defSearch" + fromTypeahead.toString()).val().trim().replace(/'/g, "''"); $scope.query2.where = "" + $scope.addToSearchAheadOutFields[fromTypeahead - 1] + " = '" + $scope.thisTxtboxSearch + "'"; $scope.queryTask.execute($scope.query2, $scope.showResults); } else { while (numQueryField < $scope.numDqueryField + 1) { //create query string for textboxes //alert(numQueryField.toString()); $scope.thisTxtboxSearch = $("#defSearch" + numQueryField.toString()).val().trim().replace(/'/g, "''"); if (numQueryField > 1) { $scope.searchQueryString += " AND "; } if ($scope.thisTxtboxSearch.length > 0) { $scope.searchQueryString += "(" + $scope.addToSearchAheadOutFields[numQueryField - 1] + " LIKE '%" + $scope.thisTxtboxSearch + "%')"; } else { $scope.searchQueryString += "(" + $scope.addToSearchAheadOutFields[numQueryField - 1] + " LIKE '%" + $scope.thisTxtboxSearch + "%' OR " + $scope.addToSearchAheadOutFields[numQueryField - 1] + " IS NULL)"; } numQueryField++; } if ($("#ndefaultSearch #startDate").length) { $scope.thisSearchStartDate = $("#ndefaultSearch #startDate").val().trim().replace(/'/g, "''"); $scope.thisSearchEndDate = $("#ndefaultSearch #endDate").val().trim().replace(/'/g, "''"); $scope.queryStringStartDate = ""; $scope.queryStringEndDate = ""; if ($scope.thisSearchStartDate.length > 0) { //create query string for sale date $scope.queryStringStartDate = " (" + $scope.saleDateFld + " >= '" + $scope.thisSearchStartDate + "')"; } if ($scope.thisSearchEndDate.length > 0) { $scope.queryStringEndDate = " (" + $scope.saleDateFld + " <= '" + $scope.thisSearchEndDate + "')"; } if (($scope.thisSearchStartDate.length > 0) && ($scope.thisSearchEndDate.length > 0)) { $scope.queryStringDate = $scope.queryStringStartDate + " AND" + $scope.queryStringEndDate; } else { $scope.queryStringDate = $scope.queryStringStartDate + $scope.queryStringEndDate; } } if ($("#ndefaultSearch #priceSlider-value-min").length) { //create query string for sale price $scope.priceMin = $("#ndefaultSearch #priceSlider-value-min").html().replace('$', '').replace(/,/g, ''); $scope.priceMax = $("#ndefaultSearch #priceSlider-value-max").html().replace('$', '').replace(/,/g, ''); if ($scope.priceMax == $scope.searchPriceMax) { $scope.priceMax = 99999999999; } $scope.queryStringPriceMin = ""; $scope.queryStringPriceMax = ""; if ($scope.priceMin > $scope.searchPriceMin) { $scope.queryStringPriceMin = " (" + $scope.salePriceFld + " >= '" + $scope.priceMin + "')"; } if ($scope.priceMax < 99999999999) { $scope.queryStringPriceMax = " (" + $scope.salePriceFld + " <= '" + $scope.priceMax + "')"; } if (($scope.priceMin > $scope.searchPriceMin) && ($scope.priceMax < 99999999999)) { $scope.queryStringPrice = $scope.queryStringPriceMin + " AND" + $scope.queryStringPriceMax; } else { $scope.queryStringPrice = $scope.queryStringPriceMin + $scope.queryStringPriceMax; } } if ($scope.queryStringDate.length > 0) { $scope.searchQueryString += " AND " + $scope.queryStringDate; } if ($scope.queryStringPrice.length > 0) { $scope.searchQueryString += " AND " + $scope.queryStringPrice; } $scope.query2.where = $scope.searchQueryString; $scope.queryTask.execute($scope.query2, $scope.showResults); } } else { //advanced search *separate from default search in case of customization $scope.advSearch1Query = ""; $scope.advSearch2Query = ""; $scope.advSearch3Query = ""; $scope.advSearch4Query = ""; $scope.advSearch5Query = ""; $scope.advSearch6Query = ""; var datePriceFldCt = 0; if ($("#ndefaultSearch").find("#dateFromOpt").length != 0) { datePriceFldCt = 1 } if ($("#ndefaultSearch").find("#priceBar").length != 0) { datePriceFldCt += 1 } //=====================addToSearchAheadOutFields-numOfAdvQueryVar if ($scope.directAdvSearch == 'true') { while (numQueryField < $scope.numAqueryField + 1) { $scope.thisTxtboxSearch = $("#advSearch" + numQueryField.toString()).val().trim().replace(/'/g, "''"); if ($scope.thisTxtboxSearch.length > 0) { if ($scope.searchQueryString.length > 1) { $scope.searchQueryString += " AND "; } $scope.searchQueryString += "(" + $scope.addToSearchAheadOutFields[numQueryField + $scope.numDqueryField + datePriceFldCt - 1] + " = '" + $scope.thisTxtboxSearch + "')"; } numQueryField++; } } else { $scope.thisTxtboxSearch = $("#advSearch1").val().trim().replace(/'/g, "''"); if ($scope.thisTxtboxSearch.length > 0) { $scope.searchQueryString += "(" + $scope.addToSearchAheadOutFields[3] + " LIKE '%" + $scope.thisTxtboxSearch + "%')"; } else { $scope.searchQueryString += "(" + $scope.addToSearchAheadOutFields[3] + " LIKE '%" + $scope.thisTxtboxSearch + "%' OR " + $scope.addToSearchAheadOutFields[3] + " IS NULL)"; } $scope.thisTxtboxSearch = $("#advSearch2").val().trim().replace(/'/g, "''"); if ($scope.thisTxtboxSearch.length > 0) { $scope.searchQueryString += " AND (" + $scope.addToSearchAheadOutFields[4] + " LIKE '%" + $scope.thisTxtboxSearch + "%')"; } else { $scope.searchQueryString += "AND (" + $scope.addToSearchAheadOutFields[4] + " LIKE '%" + $scope.thisTxtboxSearch + "%' OR " + $scope.addToSearchAheadOutFields[4] + " IS NULL)"; } $scope.thisTxtboxSearch = $("#advSearch3").val().trim().replace(/'/g, "''"); if ($scope.thisTxtboxSearch.length > 0) { $scope.searchQueryString += " AND (" + $scope.addToSearchAheadOutFields[5] + " LIKE '%" + $scope.thisTxtboxSearch + "%')"; } else { $scope.searchQueryString += " AND (" + $scope.addToSearchAheadOutFields[5] + " LIKE '%" + $scope.thisTxtboxSearch + "%' OR " + $scope.addToSearchAheadOutFields[5] + " IS NULL)"; } } if ($("#nadvancedSearch #startDate").length) { $scope.thisSearchStartDate = $("#nadvancedSearch #startDate").val().trim().replace(/'/g, "''"); $scope.thisSearchEndDate = $("#nadvancedSearch #endDate").val().trim().replace(/'/g, "''"); $scope.queryStringStartDate = ""; $scope.queryStringEndDate = ""; if ($scope.thisSearchStartDate.length > 0) { $scope.queryStringStartDate = " (" + $scope.saleDateFld + " >= '" + $scope.thisSearchStartDate + "')"; } if ($scope.thisSearchEndDate.length > 0) { $scope.queryStringEndDate = " (" + $scope.saleDateFld + " <= '" + $scope.thisSearchEndDate + "')"; } if (($scope.thisSearchStartDate.length > 0) && ($scope.thisSearchEndDate.length > 0)) { $scope.queryStringDate = $scope.queryStringStartDate + " AND" + $scope.queryStringEndDate; } else { $scope.queryStringDate = $scope.queryStringStartDate + $scope.queryStringEndDate; } } if ($("#nadvancedSearch #priceSlider-value-min").length) { $scope.priceMin = $("#nadvancedSearch #priceSlider-value-min").html().replace('$', '').replace(/,/g, ''); $scope.priceMax = $("#nadvancedSearch #priceSlider-value-max").html().replace('$', '').replace(/,/g, ''); if ($scope.priceMax == $scope.searchPriceMax) { $scope.priceMax = 99999999999; } $scope.queryStringPriceMin = ""; $scope.queryStringPriceMax = ""; if ($scope.priceMin > $scope.searchPriceMin) { $scope.queryStringPriceMin = " (" + $scope.salePriceFld + " >= '" + $scope.priceMin + "')"; } if ($scope.priceMax < 99999999999) { $scope.queryStringPriceMax = " (" + $scope.salePriceFld + " <= '" + $scope.priceMax + "')"; } if (($scope.priceMin > $scope.searchPriceMin) && ($scope.priceMax < 99999999999)) { $scope.queryStringPrice = $scope.queryStringPriceMin + " AND" + $scope.queryStringPriceMax; } else { $scope.queryStringPrice = $scope.queryStringPriceMin + $scope.queryStringPriceMax; } } if ($scope.queryStringDate.length > 0) { if ($scope.searchQueryString.length > 0) { $scope.searchQueryString += " AND " + $scope.queryStringDate; } else { $scope.searchQueryString = $scope.queryStringDate; } } if ($scope.queryStringPrice.length > 0) { if ($scope.searchQueryString.length > 0) { $scope.searchQueryString += " AND " + $scope.queryStringPrice; } else { $scope.searchQueryString = $scope.queryStringPrice; } } if ($scope.searchQueryString.length < 1) { $scope.searchQueryString = '1=1'; } $scope.query2.where = $scope.searchQueryString; $scope.queryTask.execute($scope.query2, $scope.showResults2); } }, 300); } //========end of custom search this.addCustomBasemap = function ($scope) { var vgin09 = new esri.dijit.BasemapLayer({ //type:"WebTiledLayer", url: "https://vginmaps.vdem.virginia.gov/arcgis/rest/services/VBMP_Imagery/VBMP2009_WGS/MapServer" //, }); var vgin09Image = new esri.dijit.Basemap({ layers: [vgin09], title: "2009 Imagery", thumbnailUrl: "img/img2009.jpg" }); //$scope.basemapGallery.add(vgin09Image); var vgin13 = new esri.dijit.BasemapLayer({ url: "https://vginmaps.vdem.virginia.gov/arcgis/rest/services/VBMP_Imagery/VBMP2013_WGS/MapServer" }); var vgin13Image = new esri.dijit.Basemap({ layers: [vgin13], title: "2013 VGIN Imagery", thumbnailUrl: "img/vgin.jpg" }); $scope.basemapGallery.add(vgin13Image); var vgin17 = new esri.dijit.BasemapLayer({ url: "https://vginmaps.vdem.virginia.gov/arcgis/rest/services/VBMP_Imagery/VBMP2017_WGS/MapServer" }); var vgin17Image = new esri.dijit.Basemap({ layers: [vgin17], title: "2017 VGIN Imagery", thumbnailUrl: "img/vgin2017.jpg" }); $scope.basemapGallery.add(vgin17Image); var vgin21 = new esri.dijit.BasemapLayer({ url: "https://vginmaps.vdem.virginia.gov/arcgis/rest/services/VBMP_Imagery/MostRecentImagery_WGS/MapServer" }); var vgin21Image = new esri.dijit.Basemap({ layers: [vgin21], title: "2021 VGIN Imagery", thumbnailUrl: "img/vgin2021.jpg" }); $scope.basemapGallery.add(vgin21Image); } var secretEmptyKey = '[$empty$]'; this.onFocus = function (e) { //alert(e.target.id); $(e.target).parent().find("ul").css('display', 'block'); //$timeout(function () { setTimeout(function () { var tempVal = $(e.target).val(); $(e.target).val(secretEmptyKey).trigger("input"); $(e.target).val(tempVal); $(e.target).trigger('input'); $(e.target).trigger('change'); }, 0); //}); }; }); //})();