Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1409 Rev 1410
Línea 237... Línea 237...
237
                $("#rows").html('');
237
                $("#rows").html('');
238
                sections = [];
238
                sections = [];
239
                $('#form-main').attr('action', action);
239
                $('#form-main').attr('action', action);
240
                $('#form-main #form-name').val(response['data']['name']);
240
                $('#form-main #form-name').val(response['data']['name']);
241
                $('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
241
                $('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
242
                $('#form-main #form-location').val(response['data']['location']);
242
                $('#form-main #location_search').val(response['data']['location_search']);
243
                $('#form-main #job_category_id').val(response['data']['job_category_id']).trigger('change');
243
                $('#form-main #job_category_id').val(response['data']['job_category_id']).trigger('change');
244
                $('#form-main #industry_id').val(response['data']['industry_id']).trigger('change');
244
                $('#form-main #industry_id').val(response['data']['industry_id']).trigger('change');
245
                $('#form-main #form-status').val(response['data']['status']);
245
                $('#form-main #form-status').val(response['data']['status']);
246
                CKEDITOR.instances['form-description'].setData(response['data']['description']);
246
                CKEDITOR.instances['form-description'].setData(response['data']['description']);
Línea 262... Línea 262...
262
        $("#rows").html('');
262
        $("#rows").html('');
263
        sections = [];
263
        sections = [];
264
        $('#form-main').attr('action', '$routeAdd');
264
        $('#form-main').attr('action', '$routeAdd');
265
        $('#form-main #form-name').val('');
265
        $('#form-main #form-name').val('');
266
        $('#form-main #job_description_id').val('').trigger('change');
266
        $('#form-main #job_description_id').val('').trigger('change');
267
        $('#form-main #form-location').val('');
267
        $('#form-main #location_search').val('');
268
        $('#form-main #job_category_id').val('').trigger('change');
268
        $('#form-main #job_category_id').val('').trigger('change');
269
        $('#form-main #industry_id').val('').trigger('change');
269
        $('#form-main #industry_id').val('').trigger('change');
270
        $('#form-main #form-status').val('$status_active');
270
        $('#form-main #form-status').val('$status_active');
271
        CKEDITOR.instances['form-description'].setData('');
271
        CKEDITOR.instances['form-description'].setData('');
272
        $('#row-lists').hide();
272
        $('#row-lists').hide();
Línea 286... Línea 286...
286
        (document.getElementById('location_search')),
286
        (document.getElementById('location_search')),
287
        {types: ['(cities)']}
287
        {types: ['(cities)']}
288
    );
288
    );
Línea 289... Línea 289...
289
 
289
 
290
    $.fn.fillInAddressLocation = function() {
-
 
291
    
290
    $.fn.fillInAddressLocation = function() {
292
    var place = autocompleteLocation.getPlace();
291
        var place = autocompleteLocation.getPlace();
293
    if (!place.geometry) {
292
        if (!place.geometry) {
294
        $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
293
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
295
        return;
294
            return;
296
    } else {
295
        } else {
297
        address1 = '';
296
            address1 = '';
298
        address2 = '';
297
            address2 = '';
299
        city1 = '';
298
            city1 = '';
300
        city2 = '';
299
            city2 = '';
301
        state = '';
300
            state = '';
302
        country = '';
301
            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('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();
-
 
Línea -... Línea 302...
-
 
302
            postal_code = '';
-
 
303
            
-
 
304
            formatted_address = place.formatted_address;
-
 
305
            latitude = place.geometry.location.lat();
-
 
306
            longitude = place.geometry.location.lng();
372
        var arrAddress = place.address_components;
307
            var arrAddress = place.address_components;
373
            
308
            
374
        $.each(arrAddress, function(i, address_component) {
309
            $.each(arrAddress, function(i, address_component) {
375
            if (address_component.types[0] == "route") {
310
                if (address_component.types[0] == "route") {
376
                address1 = address_component.long_name;
311
                    address1 = address_component.long_name;
377
            }
312
                }
378
            if (address_component.types[0] == "sublocality") {
313
                if (address_component.types[0] == "sublocality") {
379
                address2 = address_component.long_name;
314
                    address2 = address_component.long_name;
380
            }
315
                }
381
            if (address_component.types[0] == "locality") {
316
                if (address_component.types[0] == "locality") {
382
                city1 = address_component.long_name;
317
                    city1 = address_component.long_name;
383
            }
318
                }
384
            if (address_component.types[0] == "administrative_area_level_2") {
319
                if (address_component.types[0] == "administrative_area_level_2") {
385
                city2 = address_component.long_name;
320
                    city2 = address_component.long_name;
386
            }
321
                }
387
            if (address_component.types[0] == "administrative_area_level_1") {
322
                if (address_component.types[0] == "administrative_area_level_1") {
388
                state = address_component.long_name;
323
                    state = address_component.long_name;
389
            }
324
                }
390
            if (address_component.types[0] == "country") {
325
                if (address_component.types[0] == "country") {
391
                country = address_component.long_name;
326
                    country = address_component.long_name;
392
            }
327
                }
393
            if (address_component.types[0] == "postal_code") {
328
                if (address_component.types[0] == "postal_code") {
394
                postal_code = address_component.long_name;
329
                    postal_code = address_component.long_name;
395
            }
330
                }
396
        });
331
            });
397
 
332
            
398
        $('#form-add #formatted_address').val(formatted_address);
333
            $('#form-main #formatted_address').val(formatted_address);
399
        $('#form-add #address1').val(address1);
334
            $('#form-main #address1').val(address1);
400
        $('#form-add #address2').val(address2);
335
            $('#form-main #address2').val(address2);
401
        $('#form-add #city1').val(city1);
336
            $('#form-main #city1').val(city1);
402
        $('#form-add #city2').val(city2);
337
            $('#form-main #city2').val(city2);
403
        $('#form-add #state').val(state);
338
            $('#form-main #state').val(state);
404
        $('#form-add #country').val(country);
339
            $('#form-main #country').val(country);
405
        $('#form-add #postal_code').val(postal_code);
340
            $('#form-main #postal_code').val(postal_code);
-
 
341
            $('#form-main #latitude').val(latitude);
406
        $('#form-add #latitude').val(latitude);
342
            $('#form-main #longitude').val(longitude);
407
        $('#form-add #longitude').val(longitude);
-
 
408
    }
-
 
Línea 409... Línea 343...
409
}
343
        }
410
 
344
    }
411
 
345
 
412
    /**
346
    /**
Línea 548... Línea 482...
548
   
482
   
549
     /**
483
     /**
550
     * Initialize select Location
484
     * Initialize select Location
Línea 551... Línea 485...
551
     */
485
     */
552
 
486
 
553
    var validatorLocation = $('#form-location').validate({
487
    var validatorLocation = $('#location_search').validate({
554
        debug: true,
488
        debug: true,
555
        onclick: false,
489
        onclick: false,
556
        onkeyup: false,
490
        onkeyup: false,
557
        onfocusout: false,
491
        onfocusout: false,
558
        ignore: [],
492
        ignore: [],
559
        rules: {
493
        rules: {
560
            'location_search': {
494
            'location_search': {
561
                required: true,
495
                required: true,
562
                checkLocation: '#form-location #latitude'
496
                checkLocation: '#location_search #latitude'
563
            }
497
            }
564
        },
498
        },
565
        submitHandler: function(form)
499
        submitHandler: function(form)
566
        {
500
        {
567
            NProgress.start();
501
            NProgress.start();
568
            $.ajax({
502
            $.ajax({
569
                'dataType'  : 'json',
503
                'dataType'  : 'json',
570
                'accept'    : 'application/json',
504
                'accept'    : 'application/json',
571
                'method'    : 'post',
505
                'method'    : 'post',
572
                'url'       :  route_location,
506
                'url'       :  route_location,
Línea 573... Línea 507...
573
                'data'      :  $('#form-location').serialize(),
507
                'data'      :  $('#location_search').serialize(),
Línea 595... Línea 529...
595
    });
529
    });
Línea 596... Línea 530...
596
 
530
 
597
    $('body').on('click', 'a.btn-location-edit', function(e) {
531
    $('body').on('click', 'a.btn-location-edit', function(e) {
Línea 598... Línea 532...
598
        e.preventDefault();
532
        e.preventDefault();
599
        
533
        
600
        $('#form-location #location_search').val('');
534
        $('#form-main #location_search').val('');
601
        $('#form-location #formatted_address').val('');
535
        $('#form-main #formatted_address').val('');
602
        $('#form-location #address1').val('');
536
        $('#form-main #address1').val('');
603
        $('#form-location #address2').val('');
537
        $('#form-main #address2').val('');
604
        $('#form-location #country').val('');
538
        $('#form-main #country').val('');
605
        $('#form-location #state').val('');
539
        $('#form-main #state').val('');
606
        $('#form-location #city1').val('');
540
        $('#form-main #city1').val('');
607
        $('#form-location #city2').val('');
541
        $('#form-main #city2').val('');
608
        $('#form-location #postal_code').val('');
542
        $('#form-main #postal_code').val('');
609
        $('#form-location #latitude').val('');
543
        $('#form-main #latitude').val('');
Línea 610... Línea 544...
610
        $('#form-location #longitude').val('');
544
        $('#form-main #longitude').val('');
611
        validatorLocation.resetForm();
545
        validatorLocation.resetForm();
Línea 619... Línea 553...
619
        $("#location-box").modal('hide');
553
        $("#location-box").modal('hide');
620
        return false;
554
        return false;
621
    });
555
    });
Línea 622... Línea 556...
622
 
556
 
623
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
-
 
624
    autocompleteLocationNew.addListener('place_changed', $.fn.fillInAddressNewLocation);
557
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
625
});   
558
});   
Línea 626... Línea 559...
626
JS;
559
JS;
627
 
560
 
Línea 671... Línea 604...
671
<!-- Create/Edit Form -->
604
<!-- Create/Edit Form -->
672
<div class="row" id="row-form" style="display: none; padding: 16px;">
605
<div class="row" id="row-form" style="display: none; padding: 16px;">
673
   <div class="col-xs-12 col-md-12">
606
   <div class="col-xs-12 col-md-12">
674
      <form action="#" name="form-main" id="form-main">
607
      <form action="#" name="form-main" id="form-main">
675
        <input type="hidden" name="formatted_address" />
608
        <input type="hidden" name="formatted_address" />
676
        <input type="hidden" name="address1" />
609
        <input type="hidden" name="address1" id="address1" />
677
        <input type="hidden" name="address2" />
610
        <input type="hidden" name="address2" id="address2" />
678
        <input type="hidden" name="country" />
611
        <input type="hidden" name="country" id="country" />
679
        <input type="hidden" name="state" />
612
        <input type="hidden" name="state" id="state" />
680
        <input type="hidden" name="city1" />
613
        <input type="hidden" name="city1" id="city1" />
681
        <input type="hidden" name="city2" />
614
        <input type="hidden" name="city2" id="city2" />
682
        <input type="hidden" name="postal_code" />
615
        <input type="hidden" name="postal_code" id="postal_code" />
683
        <input type="hidden" name="latitude" />
616
        <input type="hidden" name="latitude" id="latitude" />
684
        <input type="hidden" name="longitude" />
617
        <input type="hidden" name="longitude" id="longitude" />
685
         <div class="form-group">
618
         <div class="form-group">
686
            <label for="form-name">LABEL_FIRST_NAME</label>
619
            <label for="form-name">LABEL_FIRST_NAME</label>
687
            <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
620
            <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
688
         </div>
621
         </div>
689
         <div class="form-group">
622
         <div class="form-group">
Línea 694... Línea 627...
694
               <option value="<?php echo $rs->uuid;?>"><?php echo $rs->name;?></option>
627
               <option value="<?php echo $rs->uuid;?>"><?php echo $rs->name;?></option>
695
               <?php endforeach; ?>
628
               <?php endforeach; ?>
696
            </select>
629
            </select>
697
         </div>
630
         </div>
698
         <div class="form-group">
631
         <div class="form-group">
699
            <label for="form-location">LABEL_LOCATION</label>
632
            <label for="location_search">LABEL_LOCATION</label>
700
            <input type="text" name="location_search" id="location_search" class="form-control" maxlength="50" />
633
            <input type="text" name="location_search" id="location_search" class="form-control" maxlength="50" />
701
         </div>
634
         </div>
702
         <div class="form-group">
635
         <div class="form-group">
703
            <label for="job_category_id">LABEL_JOB_CATEGORY</label>
636
            <label for="job_category_id">LABEL_JOB_CATEGORY</label>
704
            <select name="job_category_id" id="job_category_id" class="form-control">
637
            <select name="job_category_id" id="job_category_id" class="form-control">