Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 8156 Rev 8197
Línea 262... Línea 262...
262
        var otherElement = $(param);
262
        var otherElement = $(param);
Línea 263... Línea 263...
263
 
263
 
264
        return $.trim(otherElement.val()).length > 0;
264
        return $.trim(otherElement.val()).length > 0;
Línea -... Línea 265...
-
 
265
    }, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
-
 
266
 
-
 
267
    var autocompleteLocation = new google.maps.places.Autocomplete(
-
 
268
        (document.getElementById('location_search')),
-
 
269
        {types: ['(cities)']}
-
 
270
    );
-
 
271
    
-
 
272
    $.fn.fillInAddressLocation = function() {
-
 
273
    
-
 
274
        var place = autocompleteLocation.getPlace();
-
 
275
        if (!place.geometry) {
-
 
276
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
-
 
277
            return;
-
 
278
        } else {
-
 
279
            address1 = '';
-
 
280
            address2 = '';
-
 
281
            city1 = '';
-
 
282
            city2 = '';
-
 
283
            state = '';
-
 
284
            country = '';
-
 
285
            postal_code = '';
-
 
286
            
-
 
287
            formatted_address = place.formatted_address;
-
 
288
            latitude = place.geometry.location.lat();
-
 
289
            longitude = place.geometry.location.lng();
-
 
290
            var arrAddress = place.address_components;
-
 
291
            
-
 
292
            $.each(arrAddress, function(i, address_component) {
-
 
293
                if (address_component.types[0] == "route") {
-
 
294
                    address1 = address_component.long_name;
-
 
295
                }
-
 
296
                if (address_component.types[0] == "sublocality") {
-
 
297
                    address2 = address_component.long_name;
-
 
298
                }
-
 
299
                if (address_component.types[0] == "locality") {
-
 
300
                    city1 = address_component.long_name;
-
 
301
                }
-
 
302
                if (address_component.types[0] == "administrative_area_level_2") {
-
 
303
                    city2 = address_component.long_name;
-
 
304
                }
-
 
305
                if (address_component.types[0] == "administrative_area_level_1") {
-
 
306
                    state = address_component.long_name;
-
 
307
                }
-
 
308
                if (address_component.types[0] == "country") {
-
 
309
                    country = address_component.long_name;
-
 
310
                }
-
 
311
                if (address_component.types[0] == "postal_code") {
-
 
312
                    postal_code = address_component.long_name;
-
 
313
                }
-
 
314
            });
-
 
315
            
-
 
316
            $('#form-location #formatted_address').val(formatted_address);
-
 
317
            $('#form-location #address1').val(address1);
-
 
318
            $('#form-location #address2').val(address2);
-
 
319
            $('#form-location #city1').val(city1);
-
 
320
            $('#form-location #city2').val(city2);
-
 
321
            $('#form-location #state').val(state);
-
 
322
            $('#form-location #country').val(country);
-
 
323
            $('#form-location #postal_code').val(postal_code);
-
 
324
            $('#form-location #latitude').val(latitude);
-
 
325
            $('#form-location #longitude').val(longitude);
-
 
326
        }
-
 
327
    }
-
 
328
 
-
 
329
 
-
 
330
    var autocompleteLocationNew = new google.maps.places.Autocomplete(
-
 
331
        (document.getElementById('add_location_search')),
-
 
332
        {types: ['(cities)']}
-
 
333
    );
-
 
334
 
-
 
335
    $.fn.fillInAddressNewLocation = function() {
-
 
336
 
-
 
337
 
-
 
338
        var place = autocompleteLocationNew.getPlace();
-
 
339
        if (!place.geometry) {
-
 
340
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
-
 
341
            return;
-
 
342
        } else {
-
 
343
            address1 = '';
-
 
344
            address2 = '';
-
 
345
            city1 = '';
-
 
346
            city2 = '';
-
 
347
            state = '';
-
 
348
            country = '';
-
 
349
            postal_code = '';
-
 
350
    
-
 
351
            formatted_address = place.formatted_address;
-
 
352
            latitude = place.geometry.location.lat();
-
 
353
            longitude = place.geometry.location.lng();
-
 
354
            var arrAddress = place.address_components;
-
 
355
                
-
 
356
            $.each(arrAddress, function(i, address_component) {
-
 
357
                if (address_component.types[0] == "route") {
-
 
358
                    address1 = address_component.long_name;
-
 
359
                }
-
 
360
                if (address_component.types[0] == "sublocality") {
-
 
361
                    address2 = address_component.long_name;
-
 
362
                }
-
 
363
                if (address_component.types[0] == "locality") {
-
 
364
                    city1 = address_component.long_name;
-
 
365
                }
-
 
366
                if (address_component.types[0] == "administrative_area_level_2") {
-
 
367
                    city2 = address_component.long_name;
-
 
368
                }
-
 
369
                if (address_component.types[0] == "administrative_area_level_1") {
-
 
370
                    state = address_component.long_name;
-
 
371
                }
-
 
372
                if (address_component.types[0] == "country") {
-
 
373
                    country = address_component.long_name;
-
 
374
                }
-
 
375
                if (address_component.types[0] == "postal_code") {
-
 
376
                    postal_code = address_component.long_name;
-
 
377
                }
-
 
378
            });
-
 
379
    
-
 
380
            $('#form-add #formatted_address').val(formatted_address);
-
 
381
            $('#form-add #address1').val(address1);
-
 
382
            $('#form-add #address2').val(address2);
-
 
383
            $('#form-add #city1').val(city1);
-
 
384
            $('#form-add #city2').val(city2);
-
 
385
            $('#form-add #state').val(state);
-
 
386
            $('#form-add #country').val(country);
-
 
387
            $('#form-add #postal_code').val(postal_code);
-
 
388
            $('#form-add #latitude').val(latitude);
-
 
389
            $('#form-add #longitude').val(longitude);
Línea 265... Línea 390...
265
    }, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
390
        }
266
 
391
    }
267
 
392
 
Línea 526... Línea 651...
526
 
651
 
527
        $('#add-job-box').modal('show');
652
        $('#add-job-box').modal('show');
528
        return false;
653
        return false;
Línea -... Línea 654...
-
 
654
    });
-
 
655
 
-
 
656
    $('#form-add #last_date_of_application').datetimepicker({
-
 
657
        //viewMode: 'years',
-
 
658
        locale: 'es',
-
 
659
        format: 'DD/MM/YYYY'
Línea 529... Línea 660...
529
    });
660
    });
530
 
661
 
Línea 531... Línea 662...
531
 
662
 
Línea 575... Línea 706...
575
        });
706
        });
576
        return false;
707
        return false;
Línea 577... Línea 708...
577
 
708
 
Línea -... Línea 709...
-
 
709
    });
-
 
710
 
-
 
711
 var validatorLocation = $('#form-location').validate({
-
 
712
        debug: true,
-
 
713
        onclick: false,
-
 
714
        onkeyup: false,
-
 
715
        onfocusout: false,
-
 
716
        ignore: [],
-
 
717
        rules: {
-
 
718
            'location_search': {
-
 
719
                required: true,
-
 
720
                checkLocation: '#form-location #latitude'
-
 
721
            }
-
 
722
        },
-
 
723
        submitHandler: function(form)
-
 
724
        {
-
 
725
            NProgress.start();
-
 
726
            $.ajax({
-
 
727
                'dataType'  : 'json',
-
 
728
                'accept'    : 'application/json',
-
 
729
                'method'    : 'post',
-
 
730
                'url'       :  route_location,
-
 
731
                'data'      :  $('#form-location').serialize(),
-
 
732
            }).done(function(response) {
-
 
733
 
-
 
734
 
-
 
735
 
-
 
736
                if(response['success']) {
-
 
737
                    $('#overview-location').html(response.data);
-
 
738
                    $("#location-box").modal('hide');
-
 
739
                } else {
-
 
740
                    validatorLocation.resetForm();
-
 
741
                    $.fn.showError(response['data']);
-
 
742
                }
-
 
743
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
744
                $.fn.showError(textStatus);
-
 
745
            }).always(function() {
-
 
746
                NProgress.done();
-
 
747
            });
-
 
748
            return false;
-
 
749
        },
-
 
750
        invalidHandler: function(form, validator) {
-
 
751
        
-
 
752
        }
-
 
753
    });
-
 
754
 
-
 
755
    
-
 
756
    $('body').on('click', 'a.btn-location-edit', function(e) {
-
 
757
        e.preventDefault();
-
 
758
        
-
 
759
        $('#form-location #location_search').val('');
-
 
760
        $('#form-location #formatted_address').val('');
-
 
761
        $('#form-location #address1').val('');
-
 
762
        $('#form-location #address2').val('');
-
 
763
        $('#form-location #country').val('');
-
 
764
        $('#form-location #state').val('');
-
 
765
        $('#form-location #city1').val('');
-
 
766
        $('#form-location #city2').val('');
-
 
767
        $('#form-location #postal_code').val('');
-
 
768
        $('#form-location #latitude').val('');
-
 
769
        $('#form-location #longitude').val('');
-
 
770
        validatorLocation.resetForm();
-
 
771
        
-
 
772
        $("#location-box").modal('show');
-
 
773
    });
-
 
774
    
-
 
775
    $('.btn-location-close').on("click", function(e){
-
 
776
        e.preventDefault();
-
 
777
        
-
 
778
        $("#location-box").modal('hide');
-
 
779
        return false;
-
 
780
    });
-
 
781
    
-
 
782
 
-
 
783
    
-
 
784
 
-
 
785
    var validatorLastDateOfApplication = $('#form-last-date-of-application').validate({
-
 
786
        debug: true,
-
 
787
        onclick: false,
-
 
788
        onkeyup: false,
-
 
789
        onfocusout: false,
-
 
790
        ignore: [],
-
 
791
        rules: {
-
 
792
            'last_date_of_application': {
-
 
793
                required: true,
-
 
794
            },
-
 
795
        },
-
 
796
        
-
 
797
        submitHandler: function(form)
-
 
798
        {
-
 
799
            NProgress.start();
-
 
800
            $.ajax({
-
 
801
                'dataType'  : 'json',
-
 
802
                'accept'    : 'application/json',
-
 
803
                'method'    : 'post',
-
 
804
                'url'       :  route_last_date_of_application,
-
 
805
                'data'      :  $('#form-last-date-of-application').serialize()
-
 
806
            }).done(function(response) {
-
 
807
                if(response['success']) {
-
 
808
                
-
 
809
                    $('#overview-last-date-of-application').html(response['data']);
-
 
810
                    $("#last-date-of-application-box").modal('hide');
-
 
811
                } else {
-
 
812
                    validatorLastDateOfApplication.resetForm();
-
 
813
                    if(jQuery.type(response['data']) == 'string') {
-
 
814
                        $.fn.showError(response['data']);
-
 
815
                    } else  {
-
 
816
                        $.each(response['data'], function( fieldname, errors ) {
-
 
817
                            $.fn.showFormErrorValidator('#form-last-date-of-application #' + fieldname, errors);
-
 
818
                        });
-
 
819
                    }
-
 
820
                }
-
 
821
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
822
                $.fn.showError(textStatus);
-
 
823
            }).always(function() {
-
 
824
                NProgress.done();
-
 
825
            });
-
 
826
            return false;
-
 
827
        },
-
 
828
        invalidHandler: function(form, validator) {
-
 
829
        
-
 
830
        }
-
 
831
    });
-
 
832
    
-
 
833
    
-
 
834
    $('.btn-last-date-of-application-edit').on("click", function(e){
-
 
835
        e.preventDefault();
-
 
836
        
-
 
837
        NProgress.start();
-
 
838
        $.ajax({
-
 
839
            'dataType'  : 'json',
-
 
840
            'accept'    : 'application/json',
-
 
841
            'method'    : 'get',
-
 
842
            'url'       : route_last_date_of_application,
-
 
843
        }).done(function(response) {
-
 
844
           if(response['success']) {
-
 
845
                $('#form-last-date-of-application #last_date_of_application').val(response['data']);
-
 
846
                validatorLastDateOfApplication.resetForm();
-
 
847
                
-
 
848
                $("#last-date-of-application-box").modal('show');
-
 
849
            } else {
-
 
850
                $.fn.showError(response['data']);
-
 
851
            }
-
 
852
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
853
            $.fn.showError(textStatus);
-
 
854
        }).always(function() {
-
 
855
            NProgress.done();
-
 
856
        });
-
 
857
        return false;
-
 
858
        
-
 
859
    });
-
 
860
    
-
 
861
    $('.btn-last-date-of-application-close').on("click", function(e){
-
 
862
        e.preventDefault();
-
 
863
        
-
 
864
        $("#last-date-of-application-box").modal('hide');
-
 
865
        return false;
-
 
866
    });
-
 
867
    
-
 
868
    
-
 
869
    var validatorExtended = $('#form-extended').validate({
-
 
870
        debug: true,
-
 
871
        onclick: false,
-
 
872
        onkeyup: false,
-
 
873
        onfocusout: false,
-
 
874
        ignore: [],
-
 
875
        rules: {
-
 
876
            'description': {
-
 
877
                updateCkeditor:function() {
-
 
878
                        CKEDITOR.instances.description.updateElement();
-
 
879
                },
-
 
880
                required: false,
-
 
881
            },
-
 
882
        },
-
 
883
        
-
 
884
        submitHandler: function(form)
-
 
885
        {
-
 
886
            NProgress.start();
-
 
887
            $.ajax({
-
 
888
                'dataType'  : 'json',
-
 
889
                'accept'    : 'application/json',
-
 
890
                'method'    : 'post',
-
 
891
                'url'       :  route_extended,
-
 
892
                'data'      :  $('#form-extended').serialize()
-
 
893
            }).done(function(response) {
-
 
894
                if(response['success']) {
-
 
895
                
-
 
896
                    $('#overview-description').html(response['data']['description']);
-
 
897
                    $("#extended-box").modal('hide');
-
 
898
                } else {
-
 
899
                    validatorExtended.resetForm();
-
 
900
                    if(jQuery.type(response['data']) == 'string') {
-
 
901
                        $.fn.showError(response['data']);
-
 
902
                    } else  {
-
 
903
                        $.each(response['data'], function( fieldname, errors ) {
-
 
904
                            $.fn.showFormErrorValidator('#form-extended #' + fieldname, errors);
-
 
905
                        });
-
 
906
                    }
-
 
907
                }
-
 
908
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
909
                $.fn.showError(textStatus);
-
 
910
            }).always(function() {
-
 
911
                NProgress.done();
-
 
912
            });
-
 
913
            return false;
-
 
914
        },
-
 
915
        invalidHandler: function(form, validator) {
-
 
916
        
-
 
917
        }
-
 
918
    });
-
 
919
    
-
 
920
    
-
 
921
    $('.btn-extended-edit').on("click", function(e){
-
 
922
        e.preventDefault();
-
 
923
        
-
 
924
        NProgress.start();
-
 
925
        $.ajax({
-
 
926
            'dataType'  : 'json',
-
 
927
            'accept'    : 'application/json',
-
 
928
            'method'    : 'get',
-
 
929
            'url'       : route_extended,
-
 
930
        }).done(function(response) {
-
 
931
           if(response['success']) {
-
 
932
                CKEDITOR.instances.description.setData(response['data']['description']);
-
 
933
                validatorExtended.resetForm();
-
 
934
                
-
 
935
                $("#extended-box").modal('show');
-
 
936
            } else {
-
 
937
                $.fn.showError(response['data']);
-
 
938
            }
-
 
939
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
940
            $.fn.showError(textStatus);
-
 
941
        }).always(function() {
-
 
942
            NProgress.done();
-
 
943
        });
-
 
944
        return false;
-
 
945
        
-
 
946
    });
-
 
947
    
-
 
948
    $('.btn-extended-close').on("click", function(e){
-
 
949
        e.preventDefault();
-
 
950
        
-
 
951
        $("#extended-box").modal('hide');
-
 
952
        return false;
-
 
953
    });
-
 
954
    
-
 
955
 
-
 
956
    var validatorJobCategory = $('#form-job-category').validate({
-
 
957
        debug: true,
-
 
958
        onclick: false,
-
 
959
        onkeyup: false,
-
 
960
        ignore: [],
-
 
961
        rules: {
-
 
962
            'job-category_id': {
-
 
963
                required: false,
-
 
964
                digits: true
-
 
965
            },
-
 
966
        },
-
 
967
        submitHandler: function(form)
-
 
968
        {
-
 
969
            NProgress.start();
-
 
970
            $.ajax({
-
 
971
                'dataType'  : 'json',
-
 
972
                'accept'    : 'application/json',
-
 
973
                'method'    : 'post',
-
 
974
                'url'       :  route_job_category,
-
 
975
                'data'      :  $('#form-job-category').serialize()
-
 
976
            }).done(function(response) {
-
 
977
                if(response['success']) {
-
 
978
					$('#overview-job-category').html(response['data']);
-
 
979
                    $("#job-category-box").modal('hide');
-
 
980
                } else {
-
 
981
                    validatorJobCategory.resetForm();
-
 
982
                    if(jQuery.type(response['data']) == 'string') {
-
 
983
                        $.fn.showError(response['data']);
-
 
984
                    } else  {
-
 
985
                        $.each(response['data'], function( fieldname, errors ) {
-
 
986
                            $.fn.showFormErrorValidator('#form-job-category #' + fieldname, errors);
-
 
987
                        });
-
 
988
                    }
-
 
989
                }
-
 
990
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
991
                $.fn.showError(textStatus);
-
 
992
            }).always(function() {
-
 
993
                NProgress.done();
-
 
994
            });
-
 
995
            return false;
-
 
996
        },
-
 
997
        invalidHandler: function(form, validator) {
-
 
998
        
-
 
999
        }
-
 
1000
    });
-
 
1001
    
-
 
1002
    $('.btn-job-category-edit').on("click", function(e){
-
 
1003
        e.preventDefault();
-
 
1004
        
-
 
1005
        NProgress.start();
-
 
1006
        $.ajax({
-
 
1007
            'dataType'  : 'json',
-
 
1008
            'accept'    : 'application/json',
-
 
1009
            'method'    : 'get',
-
 
1010
            'url'       : route_job_category,
-
 
1011
        }).done(function(response) {
-
 
1012
           if(response['success']) {
-
 
1013
                $('#form-job-category #job_category_id').val(response['data']).trigger('change');
-
 
1014
                validatorJobCategory.resetForm();
-
 
1015
                $("#job-category-box").modal('show');
-
 
1016
            } else {
-
 
1017
                $.fn.showError(response['data']);
-
 
1018
            }
-
 
1019
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
1020
            $.fn.showError(textStatus);
-
 
1021
        }).always(function() {
-
 
1022
            NProgress.done();
-
 
1023
        });
-
 
1024
        return false;
-
 
1025
        
-
 
1026
    });
-
 
1027
    
-
 
1028
    $('.btn-job-category-close').on("click", function(e){
-
 
1029
        e.preventDefault();
-
 
1030
        
-
 
1031
        $("#job-category-box").modal('hide');
-
 
1032
        return false;
-
 
1033
    });
-
 
1034
    
-
 
1035
 
-
 
1036
 
-
 
1037
    var validatorEmploymentType = $('#form-employment-type').validate({
-
 
1038
        debug: true,
-
 
1039
        onclick: false,
-
 
1040
        onkeyup: false,
-
 
1041
        ignore: [],
-
 
1042
        rules: {
-
 
1043
            'employment_type': {
-
 
1044
                required: false,
-
 
1045
            },
-
 
1046
        },
-
 
1047
        submitHandler: function(form)
-
 
1048
        {
-
 
1049
            NProgress.start();
-
 
1050
            $.ajax({
-
 
1051
                'dataType'  : 'json',
-
 
1052
                'accept'    : 'application/json',
-
 
1053
                'method'    : 'post',
-
 
1054
                'url'       :  route_employment_type,
-
 
1055
                'data'      :  $('#form-employment-type').serialize()
-
 
1056
            }).done(function(response) {
-
 
1057
                if(response['success']) {
-
 
1058
					$('#overview-employment-type').html(response['data']);
-
 
1059
                    $("#employment-type-box").modal('hide');
-
 
1060
                } else {
-
 
1061
                    validatorEmploymentType.resetForm();
-
 
1062
                    if(jQuery.type(response['data']) == 'string') {
-
 
1063
                        $.fn.showError(response['data']);
-
 
1064
                    } else  {
-
 
1065
                        $.each(response['data'], function( fieldname, errors ) {
-
 
1066
                            $.fn.showFormErrorValidator('#form-employment-type #' + fieldname, errors);
-
 
1067
                        });
-
 
1068
                    }
-
 
1069
                }
-
 
1070
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
1071
                $.fn.showError(textStatus);
-
 
1072
            }).always(function() {
-
 
1073
                NProgress.done();
-
 
1074
            });
-
 
1075
            return false;
-
 
1076
        },
-
 
1077
        invalidHandler: function(form, validator) {
-
 
1078
        
-
 
1079
        }
-
 
1080
    });
-
 
1081
    
-
 
1082
    $('.btn-employment-type-edit').on("click", function(e){
-
 
1083
        e.preventDefault();
-
 
1084
        
-
 
1085
        NProgress.start();
-
 
1086
        $.ajax({
-
 
1087
            'dataType'  : 'json',
-
 
1088
            'accept'    : 'application/json',
-
 
1089
            'method'    : 'get',
-
 
1090
            'url'       : route_employment_type,
-
 
1091
        }).done(function(response) {
-
 
1092
           if(response['success']) {
-
 
1093
                $('#form-employment-type #employment_type').val(response['data']).trigger('change');
-
 
1094
                validatorEmploymentType.resetForm();
-
 
1095
                $("#employment-type-box").modal('show');
-
 
1096
            } else {
-
 
1097
                $.fn.showError(response['data']);
-
 
1098
            }
-
 
1099
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
1100
            $.fn.showError(textStatus);
-
 
1101
        }).always(function() {
-
 
1102
            NProgress.done();
-
 
1103
        });
-
 
1104
        return false;
-
 
1105
        
-
 
1106
    });
-
 
1107
    
-
 
1108
    $('.btn-employment-type-close').on("click", function(e){
-
 
1109
        e.preventDefault();
-
 
1110
        
-
 
1111
        $("#employment-type-box").modal('hide');
Línea 578... Línea 1112...
578
    });
1112
        return false;
579
 
1113
    });
580
 
1114
 
581
    var validatorSalary = $('#form-salary').validate({
1115
    var validatorSalary = $('#form-salary').validate({
Línea 1115... Línea 1649...
1115
            $('#form-experience #experience_max').val('5');
1649
            $('#form-experience #experience_max').val('5');
1116
            $('#form-experience #experience_min').prop('readonly', true);
1650
            $('#form-experience #experience_min').prop('readonly', true);
1117
            $('#form-experience #experience_max').prop('readonly', true);
1651
            $('#form-experience #experience_max').prop('readonly', true);
1118
       }
1652
       }
1119
    });
1653
    });
-
 
1654
 
-
 
1655
 
-
 
1656
    var validatorStatus = $('#form-status').validate({
-
 
1657
        debug: true,
-
 
1658
        onclick: false,
-
 
1659
        onkeyup: false,
-
 
1660
        ignore: [],
-
 
1661
        rules: {
-
 
1662
            'status': {
-
 
1663
                required: false,
-
 
1664
            },
-
 
1665
        },
-
 
1666
        submitHandler: function(form)
-
 
1667
        {
-
 
1668
            NProgress.start();
-
 
1669
            $.ajax({
-
 
1670
                'dataType'  : 'json',
-
 
1671
                'accept'    : 'application/json',
-
 
1672
                'method'    : 'post',
-
 
1673
                'url'       :  route_status,
-
 
1674
                'data'      :  $('#form-status').serialize()
-
 
1675
            }).done(function(response) {
-
 
1676
                if(response['success']) {
-
 
1677
					$('#overview-status').html(response['data']['status']);
-
 
1678
                    $("#status-box").modal('hide');
-
 
1679
                } else {
-
 
1680
                    validatorStatus.resetForm();
-
 
1681
                    if(jQuery.type(response['data']) == 'string') {
-
 
1682
                        $.fn.showError(response['data']);
-
 
1683
                    } else  {
-
 
1684
                        $.each(response['data'], function( fieldname, errors ) {
-
 
1685
                            $.fn.showFormErrorValidator('#form-status #' + fieldname, errors);
-
 
1686
                        });
-
 
1687
                    }
-
 
1688
                }
-
 
1689
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
1690
                $.fn.showError(textStatus);
-
 
1691
            }).always(function() {
-
 
1692
                NProgress.done();
-
 
1693
            });
-
 
1694
            return false;
-
 
1695
        },
-
 
1696
        invalidHandler: function(form, validator) {
-
 
1697
        
-
 
1698
        }
-
 
1699
    });
-
 
1700
    
-
 
1701
    $('.btn-status-edit').on("click", function(e){
-
 
1702
        e.preventDefault();
-
 
1703
        
-
 
1704
        NProgress.start();
-
 
1705
        $.ajax({
-
 
1706
            'dataType'  : 'json',
-
 
1707
            'accept'    : 'application/json',
-
 
1708
            'method'    : 'get',
-
 
1709
            'url'       : route_status,
-
 
1710
        }).done(function(response) {
-
 
1711
           if(response['success']) {
-
 
1712
                $('#form-status #status').val(response['data']['status']);
-
 
1713
                validatorStatus.resetForm();
-
 
1714
                $("#status-box").modal('show');
-
 
1715
            } else {
-
 
1716
                $.fn.showError(response['data']);
-
 
1717
            }
-
 
1718
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
1719
            $.fn.showError(textStatus);
-
 
1720
        }).always(function() {
-
 
1721
            NProgress.done();
-
 
1722
        });
-
 
1723
        return false;
-
 
1724
        
-
 
1725
    });
-
 
1726
    
-
 
1727
    $('.btn-status-close').on("click", function(e){
-
 
1728
        e.preventDefault();
-
 
1729
        
-
 
1730
        $("#status-box").modal('hide');
-
 
1731
        return false;
-
 
1732
    });
-
 
1733
    
-
 
1734
 
-
 
1735
    var validatorTitle = $('#form-title').validate({
-
 
1736
        debug: true,
-
 
1737
        onclick: false,
-
 
1738
        onkeyup: false,
-
 
1739
        ignore: [],
-
 
1740
        rules: {
-
 
1741
            'title': {
-
 
1742
                required: true,
-
 
1743
                maxlength: 128,
-
 
1744
            },
-
 
1745
        },
-
 
1746
        submitHandler: function(form)
-
 
1747
        {
-
 
1748
            NProgress.start();
-
 
1749
            $.ajax({
-
 
1750
                'dataType'  : 'json',
-
 
1751
                'accept'    : 'application/json',
-
 
1752
                'method'    : 'post',
-
 
1753
                'url'       :  route_title,
-
 
1754
                'data'      :  $('#form-title').serialize()
-
 
1755
            }).done(function(response) {
-
 
1756
                if(response['success']) {
-
 
1757
					$('#overview-title').html(response['data']['title']);
-
 
1758
                    $("#title-box").modal('hide');
-
 
1759
                } else {
-
 
1760
                    validatorTitle.resetForm();
-
 
1761
                    if(jQuery.type(response['data']) == 'string') {
-
 
1762
                        $.fn.showError(response['data']);
-
 
1763
                    } else  {
-
 
1764
                        $.each(response['data'], function( fieldname, errors ) {
-
 
1765
                            $.fn.showFormErrorValidator('#form-title #' + fieldname, errors);
-
 
1766
                        });
-
 
1767
                    }
-
 
1768
                }
-
 
1769
            }).fail(function( jqXHR, textTitle, errorThrown) {
-
 
1770
                $.fn.showError(textTitle);
-
 
1771
            }).always(function() {
-
 
1772
                NProgress.done();
-
 
1773
            });
-
 
1774
            return false;
-
 
1775
        },
-
 
1776
        invalidHandler: function(form, validator) {
-
 
1777
        
-
 
1778
        }
-
 
1779
    });
Línea -... Línea 1780...
-
 
1780
    
-
 
1781
    $('.btn-title-edit').on("click", function(e){
-
 
1782
        e.preventDefault();
-
 
1783
        
-
 
1784
        NProgress.start();
-
 
1785
        $.ajax({
-
 
1786
            'dataType'  : 'json',
-
 
1787
            'accept'    : 'application/json',
-
 
1788
            'method'    : 'get',
-
 
1789
            'url'       : route_title,
-
 
1790
        }).done(function(response) {
-
 
1791
           if(response['success']) {
-
 
1792
                $('#form-title #title').val(response['data']['title'] );
-
 
1793
                validatorTitle.resetForm();
-
 
1794
                $("#title-box").modal('show');
-
 
1795
            } else {
-
 
1796
                $.fn.showError(response['data']);
-
 
1797
            }
-
 
1798
        }).fail(function( jqXHR, textTitle, errorThrown) {
-
 
1799
            $.fn.showError(textTitle);
-
 
1800
        }).always(function() {
-
 
1801
            NProgress.done();
-
 
1802
        });
-
 
1803
        return false;
-
 
1804
        
-
 
1805
    });
-
 
1806
    
-
 
1807
    $('.btn-title-close').on("click", function(e){
-
 
1808
        e.preventDefault();
-
 
1809
        
-
 
1810
        $("#title-box").modal('hide');
-
 
1811
        return false;
-
 
1812
    });
-
 
1813
 
-
 
1814
    $('h1.btn-edit-back').on("click", function(e){
-
 
1815
        e.preventDefault();
-
 
1816
 
-
 
1817
 
-
 
1818
        
-
 
1819
        $('#divEdit').hide();
-
 
1820
        $('#divListing').show();
-
 
1821
        return false;
-
 
1822
    });
-
 
1823
 
-
 
1824
 
-
 
1825
    CKEDITOR.replace('description', {
-
 
1826
        toolbar: [
-
 
1827
            { name: 'editing', items: [ 'Scayt' ] },
-
 
1828
            { name: 'links', items: [ 'Link', 'Unlink'] },
-
 
1829
            { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote' ] },
-
 
1830
            { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Strike', 'RemoveFormat' ] },
-
 
1831
            '/',
-
 
1832
            { name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'SpecialChar' ] },
-
 
1833
            { name: 'styles', items: [ 'Styles', 'Format' ] },
-
 
1834
            { name: 'tools', items: [ 'Maximize' ] }
-
 
1835
        ],
-
 
1836
        removePlugins: 'elementspath,Anchor',
-
 
1837
        height: 100
Línea 1120... Línea -...
1120
    
-
 
-
 
1838
    });
-
 
1839
    
1121
    
1840
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
1122
});
1841
    autocompleteLocationNew.addListener('place_changed', $.fn.fillInAddressNewLocation);
Línea 1123... Línea 1842...
1123
JS;
1842
JS;
1124
$this->inlineScript()->captureEnd();
1843
$this->inlineScript()->captureEnd();