1var app = angular.module('goh'); 2app.controller('MakeWishController',function($scope,$http,$timeout, Buckets, $upload){ 3 4 $scope.wish = { 5 title: '', 6 description: '', 7 isPrivate: 0, 8 location: '', 9 lattitude: '', 10 lngitude: '', 11 cost:0, 12 bucketId:'5', 13 subbucketId:'1', 14 dresscode:'White Shirt Blue Jeans', 15 food:'No', 16 transport:'No', 17 as_per:'Day', 18 city:'Pune', 19 instruction:`1. Do not back out at the last moment. Consistency is mandatory 202. Payment is inclusive of 50/- Dress code and 50/- on-time reporting. If not followed, penalty will be charged 213. Ensure your profile is complete; selection will be based on your details. 224. If you have any queries, please use the comment section in the app/website.`, 23 datetime:'', 24 startDate:'', 25 endDate:'', 26 skills:'', 27 organizer_id:0, 28 organizer:'', 29 contact:'', 30 email:'', 31 feepergenie:0, 32 paymentinDays:0, 33 showorganizer:0, 34 dresscodedetails:'', 35 fulfilled:0, 36 notifyorganizer:1, 37 operator:'', 38 interestedgrouplink:'', 39 isImportant:'', 40 hours:'', 41 boys:'', 42 girls:'', 43 both:'', 44 genieType:'both', 45 geniePaymentdate:'', 46 dresscodeAmount:50, 47 presentyAmount:50 48 }; 49 $scope.dropdownDisabled = false; 50 $scope.subbuck = []; 51 $scope.wishFileName = ''; 52 $scope.setFileName = function() { 53 $scope.wishFileName = $scope.files[0].name; 54 }; 55 $scope.makeWishDisabled=false; 56 $scope.wishErr={ 57 title: false, 58 bucket:false, 59 subbucket:false, 60 description:false, 61 startdate:false, 62 enddate:false, 63 geniePaymentdate:false 64 }; 65 66 67 var url = base_url + "BucketController/getsubBucket"; 68 $http.get(url).success(function(resp){ 69 $scope.subbuck = resp; 70 }); 71 72 $scope.instantflag= false; 73 $scope.getbucket = function(v){ 74 $scope.instantflag=v; 75 //console.log(v); 76 if($scope.instantflag==true){ 77 $scope.wish.bucketId=8; 78 $scope.wish.subbucketId=13; 79 } 80 }; 81 //$scope.getbucket(); 82 $scope.organizerList=[]; 83 84 $scope.isCoordinator = function(){ 85 var url = base_url + 'webapi/isCoordinator'; 86 $http.get(url).success(function(resp){ 87 if(resp.success) { 88 $scope.iswishmaker=resp.data.iswishmaker;
89 //if($scope.iswishmaker){ 90 if($scope.iswishmaker.issuperwishmaker==1){ 91 var url = base_url + 'webapi/maker/organizerList'; 92 $http.get(url).success(function(resp){ 93 if(resp.success) { 94 $scope.organizerList = resp.data.organizerList; 95 } 96 }); 97 } 98 //} 99 } 100 }); 101 102 103 }; 104 105 $scope.display=false; 106 // Fetch data 107 $scope.fetchUsers = function(){ 108 var searchText_len = $scope.wish.organizer.trim().length; 109 if(searchText_len > 0){ 110 $scope.display=true; 111 }else{ 112 $scope.display=false; 113 $scope.wish.contact=''; 114 $scope.wish.email=''; 115 } 116 } 117 118 // Set value to search box 119 $scope.setValue = function(id,$event){ 120 $scope.display=false; 121 angular.forEach($scope.organizerList, function(value, key) { 122 if(value.id==id){ 123 $scope.wish.organizer_id=value.id 124 $scope.wish.organizer = value.name; 125 $scope.wish.contact= value.contactNo; 126 $scope.wish.email= value.email; 127 } 128 }); 129 //$scope.searchResult = {}; 130 $event.stopPropagation(); 131 } 132 133 $scope.searchboxClicked = function($event){ 134 $event.stopPropagation(); 135 } 136 137 $scope.containerClicked = function(){ 138 $scope.searchResult = {}; 139 } 140 141 142 143 $scope.submitWish = function() { 144 if('' == $scope.wish.title) { 145 $scope.wishErr.title = true; 146 $timeout(function() { 147 $('#wishTitle').focus(); 148 }); 149 return; 150 }else{ 151 $scope.wishErr.title = false; 152 } 153 if('' == $scope.wish.subbucketId){ 154 $scope.wishErr.subbucket = true; 155 return; 156 } 157 if('' == $scope.wish.description){ 158 $scope.wishErr.description = true; 159 $timeout(function() { 160 $('#wishDescription').focus(); 161 }); 162 return; 163 }else{ 164 $scope.wishErr.description = false; 165 } 166 if('' == $scope.wish.startDate){ 167 $scope.wishErr.startdate = true; 168 $timeout(function() { 169 $('#start-date').focus(); 170 }); 171 return; 172 }else{ 173 $scope.wishErr.startdate = false; 174 } 175 if('' == $scope.wish.endDate){ 176 $scope.wishErr.enddate = true; 177 $timeout(function() { 178 $('#end-date').focus(); 179 }); 180 return; 181 }else{ 182 $scope.wishErr.enddate = false; 183 } 184 if('' == $scope.wish.city){ 185 $scope.wishErr.city = true; 186 return; 187 } 188 if($scope.iswishmaker.issuperwishmaker==1){ 189 if('' == $scope.wish.geniePaymentdate){ 190 $scope.wishErr.geniePaymentdate = true; 191 $timeout(function() { 192 $('#geniePaymentdate').focus(); 193 }); 194 return; 195 }else{ 196 $scope.wishErr.geniePaymentdate = false; 197 } 198 } 199 if($scope.wish.genieType == 'both'){ 200 if ($scope.wish.both === '' || $scope.wish.both === null || isNaN($scope.wish.both)) { 201 $scope.wishErr.both = true; 202 $timeout(function () { 203 $('#wishboth').focus(); 204 }); 205 alert("Number of genies should be between 0 and 999"); 206 return; 207 } else if ($scope.wish.both < 0 || $scope.wish.both > 999) { 208 $timeout(function () { 209 $('#wishboth').focus(); 210 }); 211 alert("Number of genies should be between 0 and 999"); 212 return; 213 }else{ 214 $scope.wishErr.both = false; 215 } 216 } 217 218 if ($scope.wish.genieType == 'eighter') { 219 220 if ($scope.wish.girls === '' || $scope.wish.girls === null || isNaN($scope.wish.girls)) { 221 $timeout(function () { 222 $('#no_of_girls').focus(); 223 }); 224 return; 225 } else if ($scope.wish.girls < 0 || $scope.wish.girls > 999) { 226 $timeout(function () { 227 $('#no_of_girls').focus(); 228 }); 229 alert("Number of girls should be between 0 and 999"); 230 return; 231 } 232 233 if ($scope.wish.boys === '' || $scope.wish.boys === null || isNaN($scope.wish.boys)) { 234 $timeout(function () { 235 $('#no_of_boys').focus(); 236 }); 237 return; 238 } else if ($scope.wish.boys < 0 || $scope.wish.boys > 999) { 239 $timeout(function () { 240 $('#no_of_boys').focus(); 241 }); 242 alert("Number of boys should be between 0 and 999"); 243 return; 244 } 245 246 } 247 248 if( '' == $scope.wish.title || '' == $scope.wish.subbucketId || '' == $scope.wish.startdate || '' == $scope.wish.enddate || '' ==$scope.wish.description || $scope.wish.city == ''){ 249 alert('Please fill the required fields'); 250 //return; 251 } 252 else{ 253 $scope.makeWishDisabled=true; 254 $scope.wish.location = $scope.location.address; 255 $scope.wish.lattitude = $scope.location.lat; 256 $scope.wish.lngitude = $scope.location.lng; 257 /* if($scope.iswishmaker.issuperwishmaker==1){ 258 $scope.wish.fulfilled=1; 259 }else{ 260 $scope.wish.fulfilled=0; 261 } */ 262 if($scope.iswishmaker.issuperwishmaker!=1){ 263 $scope.wish.fulfilled=0; 264 } 265 if($scope.files != undefined) { 266 $scope.upload($scope.files); 267 } else { 268 269 //console.log($scope.wish.fulfilled); 270 var url = base_url + 'webapi/makeWish'; 271 $http.post(url, $scope.wish).success(function(response){ 272 if(response.success){ 273 var wishid = response.data.wishId; 274 window.location.href = base_url + "wish/single/"+ wishid; 275 //window.location.href = base_url + "wishmaker/dashboard" 276 } 277 else{ 278 alert('Fail to submit your wish.Please try again'); 279 $scope.makeWishDisabled=false; 280 } 281 }); 282 } 283 } 284 }; 285 286 $scope.upload = function (files) { 287 288 var url = base_url + 'webapi/makeWish'; 289 290 if (files && files.length) { 291 for (var i = 0; i < files.length; i++) { 292 var file = files[i]; 293 $upload.upload({ 294 url: url, 295 fields: $scope.wish, 296 file: file 297 }).progress(function (evt) { 298 var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); 299 console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name); 300 }).success(function (data, status, headers, config) { 301 $scope.response = data; 302 303 if($scope.response.success) { 304 window.location.href = base_url + "wishmaker/dashboard" 305 } 306 307 console.log('file ' + config.file.name + 'uploaded. Response: ' + data); 308 }); 309 } 310 } 311 }; 312 313 $scope.checkBucket = function(){ 314 console.log('asdfffffffff'); 315 var f= true; 316 angular.forEach($scope.subbuck, function(value, key) { 317 if(f) { 318 if($scope.wish.bucketId == value.bucketid) 319 { 320 $scope.wish.subbucketId =value.id; 321 f = false;
322 } 323 } 324 }); 325 }; 326 327 $scope.checkSubBucket = function(){ 328 if($scope.wish.subbucketId){ 329 // alert($scope.wish.subbucketId); 330 var url = base_url + 'index.php/webapi/GenieController/subdescription?id='+$scope.wish.subbucketId; 331 $http.get(url).success(function(resp){ 332 if(resp.success) { 333 $scope.wish.description = resp.data.msg; 334 }else{ 335 alert(resp.error.msg); 336 $scope.wish.description = ''; 337 } 338 }); 339 }else{ 340 // $scope.wish.description = ''; 341 } 342 } 343 344 345 $scope.buckets = Buckets.query(); 346 347 348 $timeout(function() { 349 //$('select').selectpicker('refresh'); 350 }, 300); 351 352 $('#start-date').datetimepicker({ 353 format: 'yyyy-mm-dd hh:ii', 354 // startView: 0, 355 autoclose: true, 356 // todayHighlight: true, 357 startDate: new Date() 358 }) 359 .on('changeDate', function (ev) { 360 $scope.wish.startDate = $(ev.target).val(); 361 }); 362 363 $('#end-date').datetimepicker({ 364 format: 'yyyy-mm-dd hh:ii', 365 // startView: 0, 366 autoclose: true, 367 // todayHighlight: true, 368 // endDate: new Date() 369 }) 370 .on('changeDate', function (ev) { 371 $scope.wish.endDate = $(ev.target).val(); 372 }); 373 374 $scope.isCoordinator(); 375});
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.