Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1400 | Rev 1407 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1400 Rev 1403
Línea 285... Línea 285...
285
    var autocompleteLocation = new google.maps.places.Autocomplete(
285
    var autocompleteLocation = new google.maps.places.Autocomplete(
286
        (document.getElementById('location_search')),
286
        (document.getElementById('location_search')),
287
        {types: ['(cities)']}
287
        {types: ['(cities)']}
288
    );
288
    );
Línea -... Línea 289...
-
 
289
 
-
 
290
    $.fn.fillInAddressLocation = function() {
-
 
291
    
-
 
292
    var place = autocompleteLocation.getPlace();
-
 
293
    if (!place.geometry) {
-
 
294
        $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
-
 
295
        return;
-
 
296
    } else {
-
 
297
        address1 = '';
-
 
298
        address2 = '';
-
 
299
        city1 = '';
-
 
300
        city2 = '';
-
 
301
        state = '';
-
 
302
        country = '';
-
 
303
        postal_code = '';
-
 
304
        
-
 
305
        formatted_address = place.formatted_address;
-
 
306
        latitude = place.geometry.location.lat();
-
 
307
        longitude = place.geometry.location.lng();
-
 
308
        var arrAddress = place.address_components;
-
 
309
        
-
 
310
        $.each(arrAddress, function(i, address_component) {
-
 
311
            if (address_component.types[0] == "route") {
-
 
312
                address1 = address_component.long_name;
-
 
313
            }
-
 
314
            if (address_component.types[0] == "sublocality") {
-
 
315
                address2 = address_component.long_name;
-
 
316
            }
-
 
317
            if (address_component.types[0] == "locality") {
-
 
318
                city1 = address_component.long_name;
-
 
319
            }
-
 
320
            if (address_component.types[0] == "administrative_area_level_2") {
-
 
321
                city2 = address_component.long_name;
-
 
322
            }
-
 
323
            if (address_component.types[0] == "administrative_area_level_1") {
-
 
324
                state = address_component.long_name;
-
 
325
            }
-
 
326
            if (address_component.types[0] == "country") {
-
 
327
                country = address_component.long_name;
-
 
328
            }
-
 
329
            if (address_component.types[0] == "postal_code") {
-
 
330
                postal_code = address_component.long_name;
-
 
331
            }
-
 
332
        });
-
 
333
        
-
 
334
        $('#form-location #formatted_address').val(formatted_address);
-
 
335
        $('#form-location #address1').val(address1);
-
 
336
        $('#form-location #address2').val(address2);
-
 
337
        $('#form-location #city1').val(city1);
-
 
338
        $('#form-location #city2').val(city2);
-
 
339
        $('#form-location #state').val(state);
-
 
340
        $('#form-location #country').val(country);
-
 
341
        $('#form-location #postal_code').val(postal_code);
-
 
342
        $('#form-location #latitude').val(latitude);
-
 
343
        $('#form-location #longitude').val(longitude);
-
 
344
    }
-
 
345
}
-
 
346
 
-
 
347
 
-
 
348
var autocompleteLocationNew = new google.maps.places.Autocomplete(
-
 
349
    (document.getElementById('add_location_search')),
-
 
350
    {types: ['(cities)']}
-
 
351
);
-
 
352
 
-
 
353
$.fn.fillInAddressNewLocation = function() {
-
 
354
 
-
 
355
 
-
 
356
    var place = autocompleteLocationNew.getPlace();
-
 
357
    if (!place.geometry) {
-
 
358
        $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
-
 
359
        return;
-
 
360
    } else {
-
 
361
        address1 = '';
-
 
362
        address2 = '';
-
 
363
        city1 = '';
-
 
364
        city2 = '';
-
 
365
        state = '';
-
 
366
        country = '';
-
 
367
        postal_code = '';
-
 
368
 
-
 
369
        formatted_address = place.formatted_address;
-
 
370
        latitude = place.geometry.location.lat();
-
 
371
        longitude = place.geometry.location.lng();
-
 
372
        var arrAddress = place.address_components;
-
 
373
            
-
 
374
        $.each(arrAddress, function(i, address_component) {
-
 
375
            if (address_component.types[0] == "route") {
-
 
376
                address1 = address_component.long_name;
-
 
377
            }
-
 
378
            if (address_component.types[0] == "sublocality") {
-
 
379
                address2 = address_component.long_name;
-
 
380
            }
-
 
381
            if (address_component.types[0] == "locality") {
-
 
382
                city1 = address_component.long_name;
-
 
383
            }
-
 
384
            if (address_component.types[0] == "administrative_area_level_2") {
-
 
385
                city2 = address_component.long_name;
-
 
386
            }
-
 
387
            if (address_component.types[0] == "administrative_area_level_1") {
-
 
388
                state = address_component.long_name;
-
 
389
            }
-
 
390
            if (address_component.types[0] == "country") {
-
 
391
                country = address_component.long_name;
-
 
392
            }
-
 
393
            if (address_component.types[0] == "postal_code") {
-
 
394
                postal_code = address_component.long_name;
-
 
395
            }
-
 
396
        });
-
 
397
 
-
 
398
        $('#form-add #formatted_address').val(formatted_address);
-
 
399
        $('#form-add #address1').val(address1);
-
 
400
        $('#form-add #address2').val(address2);
-
 
401
        $('#form-add #city1').val(city1);
-
 
402
        $('#form-add #city2').val(city2);
-
 
403
        $('#form-add #state').val(state);
-
 
404
        $('#form-add #country').val(country);
-
 
405
        $('#form-add #postal_code').val(postal_code);
-
 
406
        $('#form-add #latitude').val(latitude);
-
 
407
        $('#form-add #longitude').val(longitude);
-
 
408
    }
-
 
409
}
-
 
410
 
289
 
411
 
290
    /**
412
    /**
291
     * Clicked cancel new/edit Form
413
     * Clicked cancel new/edit Form
292
     */
414
     */
293
    $('button.btn-edit-cancel').click(function(e) {
415
    $('button.btn-edit-cancel').click(function(e) {
Línea 338... Línea 460...
338
                'url': $('#form-main').attr('action'),
460
                'url': $('#form-main').attr('action'),
339
                'data': {
461
                'data': {
340
                    'name': $('#form-main #form-name').val(),
462
                    'name': $('#form-main #form-name').val(),
341
                    'job_description_id': $('#form-main #job_description_id').val(),
463
                    'job_description_id': $('#form-main #job_description_id').val(),
342
                    'location' :$('#form-main #form-location').val(),
464
                    'location' :$('#form-main #form-location').val(),
-
 
465
                    'formatted_address': $('#form-main #formatted_address').val(),
-
 
466
                    'address1': $('#form-main #address1').val(),
-
 
467
                    'address2': $('#form-main #address2').val(),
-
 
468
                    'country': $('#form-main #country').val(),
-
 
469
                    'state': $('#form-main #state').val(),
-
 
470
                    'city1': $('#form-main #city1').val(),
-
 
471
                    'city2': $('#form-main #city2').val(),
-
 
472
                    'postal_code': $('#form-main #postal_code').val(),
-
 
473
                    'latitude': $('#form-main #latitude').val(),
-
 
474
                    'longitude': $('#form-main #longitude').val(),
343
                    'job_category_id' :$('#form-main #job_category_id').val(),
475
                    'job_category_id' :$('#form-main #job_category_id').val(),
344
                    'industry_id' :$('#form-main #industry_id').val(),
476
                    'industry_id' :$('#form-main #industry_id').val(),
345
                    'status': $('#form-main #form-status').val(),
477
                    'status': $('#form-main #form-status').val(),
346
                    'description': $('#form-main #form-description').val(),
478
                    'description': $('#form-main #form-description').val(),
347
                    'content': JSON.stringify(sections)
479
                    'content': JSON.stringify(sections)
Línea 535... Línea 667...
535
</div>
667
</div>
536
<!-- Create/Edit Form -->
668
<!-- Create/Edit Form -->
537
<div class="row" id="row-form" style="display: none; padding: 16px;">
669
<div class="row" id="row-form" style="display: none; padding: 16px;">
538
   <div class="col-xs-12 col-md-12">
670
   <div class="col-xs-12 col-md-12">
539
      <form action="#" name="form-main" id="form-main">
671
      <form action="#" name="form-main" id="form-main">
-
 
672
        <input type="hidden" name="formatted_address" />
-
 
673
        <input type="hidden" name="address1" />
-
 
674
        <input type="hidden" name="address2" />
-
 
675
        <input type="hidden" name="country" />
-
 
676
        <input type="hidden" name="state" />
-
 
677
        <input type="hidden" name="city1" />
-
 
678
        <input type="hidden" name="city2" />
-
 
679
        <input type="hidden" name="postal_code" />
-
 
680
        <input type="hidden" name="latitude" />
-
 
681
        <input type="hidden" name="longitude" />
540
         <div class="form-group">
682
         <div class="form-group">
541
            <label for="form-name">LABEL_FIRST_NAME</label>
683
            <label for="form-name">LABEL_FIRST_NAME</label>
542
            <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
684
            <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
543
         </div>
685
         </div>
544
         <div class="form-group">
686
         <div class="form-group">