1'use strict'; 2 3/* Controllers */ 4 5angular 6 .module('app') 7 .controller('PropertiUnitSewaDetailFrontendCtrl', PropertiUnitSewaDetailFrontendController); 8 9 PropertiUnitSewaDetailFrontendController.$inject = ['$scope', '$sce', '$rootScope', 'ServerService', 'SettingsService', '$state', 'SweetAlert', '$location'] 10 function PropertiUnitSewaDetailFrontendController($scope, $sce ,$rootScope, ServerService, SettingsService, $state, SweetAlert, $location){ 11 var vm = this; 12 13 // VM variable 14 vm.data = {}; 15 vm.contactData = {}; 16 vm.propertyUnitModal = {}; 17 $scope.loading = false; 18 19 // $scope.baseImageURL = "https://s3-ap-southeast-1.amazonaws.com/gradana/"; 20 // $scope.baseImageURL = "https://gradana-backup-test.oss-ap-southeast-5.aliyuncs.com/"; 21 $scope.baseImageURL = "https://gradana-prod.oss-ap-southeast-5.aliyuncs.com/"; 22 var currentUser = {}; 23 24 $scope.toggleModalContact = function() { 25 $('#modalHubSaya').modal('show'); 26 } 27 28 $scope.navigatePage = function(toPage) { 29 if(toPage === 'signupBorrower') { 30 $state.go('access.signup', { role: 'peminjam', type: 'GraSewa' }) 31 } else if(toPage === 'login'){ 32 $state.go('access.login') 33 } 34 } 35 36 $scope.convertLineBreak = function(paragraph){ 37 var tempParagraph = paragraph.split('\n'); 38 var fixParagraph = tempParagraph.join('<br>'); 39 40 return fixParagraph; 41 } 42 43 $scope.trustAsHtml = function(value) { 44 return $sce.trustAsHtml(value); 45 }; 46 47 if($state.params.propertiUnitId){ 48 ServerService.GetPropertyUnit(currentUser, $state.params.propertiUnitId, function(response){ 49 if(response){ 50 if(response.status === 'Success'){ 51 if(response.data){ 52 vm.data = response.data; 53 if (vm.data.description) { 54 $scope.description = $scope.convertLineBreak(vm.data.description); 55 } 56 57 vm.latitude = vm.data.location.coordinates[0]; 58 vm.longitude = vm.data.location.coordinates[1]; 59 60 var map; 61 var zoomLevel = 16; 62 var latLng = new google.maps.LatLng(vm.longitude,vm.latitude); 63 function googleMapInit() { 64 // Basic options for a simple Google Map 65 // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions 66 var mapOptions = { 67 // How zoomed in you want the map to start at (always required) 68 zoom: zoomLevel, 69 disableDefaultUI: false, 70 // The latitude and longitude to center the map (always required) 71 center: latLng, // New York 72 scrollwheel: true, 73 draggable: true 74 }; 75 76 var marker = new google.maps.Marker({ 77 position: latLng 78 }); 79 80 // Get the HTML DOM element that will contain your map 81 // We are using a div with id="map" seen below in the <body> 82 var mapElement = document.getElementById('google-map-property'); 83 84 // Create the Google Map using out element and options defined above 85 map = new google.maps.Map(mapElement, mapOptions); 86 marker.setMap(map); 87 } 88 89 googleMapInit(); 90 } else { 91 $scope.loading = false;
92 } 93 } else { 94 SweetAlert.swal('Error', response.message, 'error'); 95 $scope.loading = false; 96 } 97 } else { 98 SweetAlert.swal('Tidak ada tanggapan dari server', 'Coba refresh halaman atau cek koneksi internet', 'error'); 99 $scope.loading = false; 100 } 101 }) 102 } 103 104 $scope.submitContactPropertyUnit = function(){ 105 var emailData = { 106 subjectEmail: '[Gradana] Tertarik pada Properti Unit Sewa' 107 } 108 var currentUrl = $location.absUrl(); 109 110 if(currentUrl.includes('dev.gradana') === true || currentUrl.includes('137.59.126.204')){ 111 emailData.destinationEmail = '[email protected]' 112 } else if(currentUrl.includes('gradana.co.id') == true || currentUrl.includes('gradana.com') == true || currentUrl.includes('116.206.196.96')){ 113 emailData.destinationEmail = '[email protected]'; 114 } else { 115 emailData.destinationEmail = '[email protected]'; 116 } 117 118 emailData.message = 119 "Hai Admin Gradana, seseorang tertarik untuk mengetahui lebih tahu mengenai:\n\n" + 120 "Properti Unit: " + vm.data.name + "\n" + 121 "Alamat: " + vm.data.address + "\n\n" + 122 "Kontak\n" + 123 "Nama: " + vm.contactData.name + "\n" + 124 "Email: " + vm.contactData.email + "\n" + 125 "No. HP: " + vm.contactData.mobileNumber + "\n" + 126 "Pesan: " + vm.contactData.pesanMessage 127 128 $scope.loading = true; 129 ServerService.SendEmail(emailData, function(response){ 130 if (response) { 131 if (response.status == 'Success') { 132 SweetAlert.swal('Berhasil', 'Terima Kasih. Admin Gradana akan segera mengontak anda dalam waktu 3x24 jam', 'success'); 133 $('#modalHubSaya').modal('hide'); 134 $scope.loading = false; 135 } else { 136 $('#modalHubSaya').modal('hide'); 137 $scope.loading = false; 138 } 139 } else { 140 SweetAlert.swal('Tidak ada tanggapan dari server', 'Coba refresh halaman atau cek koneksi internet', 'error'); 141 $scope.loading = false; 142 } 143 }) 144 } 145 146 $scope.propertyUnitImageLightBoxToggle = function(){ 147 var dynamicEl = []; 148 149 for (var i = 0; i < vm.data.imagesPath.length; i++) { 150 var currentImage = vm.data.imagesPath[i]; 151 152 var imageObject = { 153 "src": $scope.baseImageURL + currentImage, 154 'thumb': $scope.baseImageURL + currentImage 155 } 156 157 dynamicEl.push(imageObject); 158 } 159 160 lightGallery(document.getElementById('property-unit-image-lightbox'), { 161 dynamic: true, 162 dynamicEl: dynamicEl 163 }) 164 } 165 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.