Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 3064 Rev 3071
Línea 67... Línea 67...
67
$this->headStyle()->captureEnd();
67
$this->headStyle()->captureEnd();
Línea 68... Línea 68...
68
 
68
 
69
$this->inlineScript()->captureStart();
69
$this->inlineScript()->captureStart();
Línea 70... Línea -...
70
echo <<<JS
-
 
71
 
-
 
72
const classFormGenerator = function() {
-
 
73
    this.id = 0,
-
 
74
        this.table = '',
-
 
75
        this.text = '',
-
 
76
        this.behaviors = [],
-
 
77
        this.clear = function() {
-
 
78
            this.behaviors = [];
-
 
79
            this.render();
-
 
80
        },
-
 
81
       
-
 
82
        /**
-
 
83
         * Add element to section array
-
 
84
         */
-
 
85
        this.addSection = function( text, value) {
-
 
86
            var d = new Date();
-
 
87
            var slug = 'section' + d.getTime();
-
 
88
            var position = 0;
-
 
89
            $.each(this.behaviors, function(index, section) {
-
 
90
                if (position < section.position) {
-
 
91
                    position = section.position;
-
 
92
                }
-
 
93
            });
-
 
94
            position++;
-
 
95
            var section = {
-
 
96
                'slug_behaviors': slug,
-
 
97
                'text': text,
-
 
98
                'value': value,
-
 
99
                'position': position,
-
 
100
                'questions': [],
-
 
101
                'status': 0
-
 
102
            }
-
 
103
            this.behaviors.push(section);
-
 
104
        },
-
 
105
         /**
-
 
106
         * Edit element to section array
-
 
107
         */
-
 
108
        this.editSection = function(slug, text, value) {
-
 
109
            var renderTable = false;
-
 
110
            for (i = 0; i < this.behaviors.length; i++) {
-
 
111
                if (slug == this.behaviors[i].slug_behaviors) {
-
 
112
                    this.behaviors[i].text = text;
-
 
113
                    this.behaviors[i].value = value;
-
 
114
                    renderTable = true;
-
 
115
                    break;
-
 
116
                }
-
 
117
            }
-
 
118
            if (renderTable) {
-
 
119
                this.renderSection(slug);
-
 
120
            }
-
 
121
        },
-
 
122
         /**
-
 
123
         * Remove element to section array
-
 
124
         */
-
 
125
        this.deleteSection = function(slug) {
-
 
126
            var renderTable = false;
-
 
127
            for (i = 0; i < this.behaviors.length; i++) {
-
 
128
                if (slug == this.behaviors[i].slug_behaviors) {
-
 
129
                    this.behaviors.splice(i, 1);
-
 
130
                    renderTable = true;
-
 
131
                    break;
-
 
132
                }
-
 
133
            }
-
 
134
            if (renderTable) {
-
 
135
                $('#panel' + slug).remove();
-
 
136
            }
-
 
137
        }        
-
 
138
}
70
echo <<<JS
139
 
-
 
140
jQuery( document ).ready(function( $ ) {
-
 
141
    var objFormGenerator = new classFormGenerator();
71
 
142
    //objFormGenerator.render();
72
jQuery( document ).ready(function( $ ) {
143
    $.validator.setDefaults({
73
    $.validator.setDefaults({
144
        debug: true,
74
        debug: true,
145
        highlight: function(element) {
75
        highlight: function(element) {
Línea 219... Línea 149...
219
                }
149
                }
220
            }).done(function(response) {
150
            }).done(function(response) {
221
                NProgress.start();
151
                NProgress.start();
222
                if (response['success']) {
152
                if (response['success']) {
223
                    $.fn.showSuccess(response['data']);
153
                    $.fn.showSuccess(response['data']);
224
                    $('#main').show();
154
                    $('#main').hide();
225
                    $('#interview').hide();
155
                    $('#interview').hide();
226
                    $('#vacancy_uuid').change();
156
                    $('#vacancy_uuid').change();
227
                } else {
157
                } else {
228
                    validator.resetForm();
158
                    validator.resetForm();
229
                    if (jQuery.type(response['data']) == 'string') {
159
                    if (jQuery.type(response['data']) == 'string') {