Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 8524 Rev 8525
Línea 25... Línea 25...
25
$routeHeaderUpload = $this->url('profile/header', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
25
$routeHeaderUpload = $this->url('profile/header', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
Línea 26... Línea 26...
26
 
26
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
27
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
Línea -... Línea 28...
-
 
28
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
29
 
-
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
-
 
31
 
-
 
32
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
33
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
-
 
34
 
-
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
36
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
37
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
-
 
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
-
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
40
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
29
 
41
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
Línea 31... Línea 43...
31
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
44
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
33
 
45
 
Línea 34... Línea -...
34
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
-
 
35
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
-
 
36
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.min.js'));
-
 
37
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.min.js'));
47
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
Línea -... Línea 48...
-
 
48
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.min.js'));
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
49
 
40
 
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
Línea 42... Línea 52...
42
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
52
 
43
 
53
 
44
$this->inlineScript()->captureStart();
54
$this->inlineScript()->captureStart();
45
echo <<<JS
55
echo <<<JS
-
 
56
jQuery( document ).ready(function( $ ) {
46
jQuery( document ).ready(function( $ ) {
57
 
47
 
58
    $.validator.addMethod('greaterThan', function (value, element, param) {
48
	var validatorCompanySize = $('#form-company-size').validate({
-
 
49
        debug: true,
59
        var otherElement = $(param);
50
        onclick: false,
60
        return parseInt(value, 10) > parseInt(otherElement.val(), 10);
51
        onkeyup: false,
61
    }, 'ERROR_INVALID_MINIMUM');
52
        onfocusout: false,
-
 
53
        ignore: [],
-
 
54
        rules: {
62
    
55
            'company_size_id': {
-
 
56
                required: true,
63
            $.validator.setDefaults({
57
            },
64
            debug: true,
58
        },
65
            highlight: function(element) {
59
 
66
                $(element).addClass('is-invalid');
60
        submitHandler: function(form)
67
            },
61
        {
-
 
62
            NProgress.start();
68
            unhighlight: function(element) {
63
            $.ajax({
-
 
64
                'dataType'  : 'json',
69
                $(element).removeClass('is-invalid');
65
                'accept'    : 'application/json',
-
 
66
                'method'    : 'post',
70
            },
67
                'url'       :  $('#form-company-size').attr('action'),
71
            errorElement: 'span',
68
                'data'      :  $('#form-company-size').serialize()
72
            errorClass: 'error invalid-feedback',
69
            }).done(function(response) {
-
 
70
                if(response['success']) {
-
 
71
 
73
            errorPlacement: function(error, element) {
72
                    $('#overview-company-size').html(response['data']);
-
 
73
                    $("#company-size-box").modal('hide');
-
 
74
                } else {
-
 
75
                    validatorCompanySize.resetForm();
-
 
76
                    if(jQuery.type(response['data']) == 'string') {
-
 
77
                        $.fn.showError(response['data']);
74
                if(element.parent('.form-group').length) {
78
                    } else  {
-
 
79
                        $.each(response['data'], function( fieldname, errors ) {
-
 
80
                            $.fn.showFormErrorValidator('#form-company-size #' + fieldname, errors);
-
 
81
                        });
-
 
82
                    }
-
 
83
                }
-
 
84
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
85
                $.fn.showError(textStatus);
-
 
86
            }).always(function() {
-
 
87
                NProgress.done();
-
 
88
            });
-
 
89
            return false;
-
 
90
        },
-
 
91
        invalidHandler: function(form, validator) {
-
 
92
        
-
 
93
        }
-
 
94
    });
-
 
95
 
-
 
96
 
-
 
97
    $('.btn-company-size-edit').on("click", function(e){
-
 
98
        e.preventDefault();
-
 
99
 
-
 
100
        NProgress.start();
-
 
101
        $.ajax({
-
 
102
            'dataType'  : 'json',
-
 
103
            'accept'    : 'application/json',
-
 
104
            'method'    : 'get',
-
 
105
            'url'       : '$routeCompanySize',
-
 
106
        }).done(function(response) {
-
 
107
           if(response['success']) {
-
 
108
				$('#form-company-size #company_size_id').val(response['data']['company_size_id']).trigger('change');
-
 
109
           
75
                    error.insertAfter(element);
110
                validatorCompanySize.resetForm();
-
 
111
 
-
 
112
                $("#company-size-box").modal('show');
-
 
113
            } else {
-
 
114
                $.fn.showError(response['data']);
76
                } else if(element.parent('.toggle').length) {
115
            }
-
 
116
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
117
            $.fn.showError(textStatus);
-
 
Línea 118... Línea -...
118
        }).always(function() {
-
 
119
            NProgress.done();
-
 
120
        });
77
                    error.insertAfter(element.parent().parent());
-
 
78
                } else {
121
        return false;
79
                    error.insertAfter(element.parent());
122
 
80
                }
-
 
81
            }
123
    });
82
        });
Línea -... Línea 83...
-
 
83
    
-
 
84
    
-
 
85
        $.fn.showFormErrorValidator = function(fieldname, errors) {
-
 
86
            var field = $(fieldname);
-
 
87
            if(field) {
-
 
88
                $(field).addClass('is-invalid');
-
 
89
    
-
 
90
 
-
 
91
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
-
 
92
                if(field.parent('.form-group').length) {
-
 
93
                    error.insertAfter(field);
124
    
94
                } else  if(field.parent('.toggle').length) {
125
    $('.btn-company-size-close').on("click", function(e){
95
                    error.insertAfter(field.parent().parent());
126
        e.preventDefault();
96
                } else {
127
        
97
                    error.insertAfter(field.parent());
128
        $("#company-size-box").modal('hide');
98
                }
129
        return false;
99
            }
130
    });
100
        };
131
 
101
    
-
 
102
    var validatorExtended = $('#form-extended').validate({
-
 
103
        debug: true,
-
 
104
        onclick: false,
132
	var validatorIndustry = $('#form-industry').validate({
105
        onkeyup: false,
133
        debug: true,
106
        onfocusout: false,
134
        onclick: false,
107
        ignore: [],
Línea 135... Línea 108...
135
        onkeyup: false,
108
        rules: {
136
        onfocusout: false,
109
            'description': {
137
        ignore: [],
110
                updateCkeditor:function() {
138
        rules: {
111
                        CKEDITOR.instances.description.updateElement();
139
            'industry_id': {
112
                },
140
                required: true,
113
                required: false,
141
            },
114
            },
142
        },
115
        },
143
 
116
 
144
        submitHandler: function(form)
117
        submitHandler: function(form)
145
        {
118
        {
Línea 146... Línea 119...
146
            NProgress.start();
119
            NProgress.start();
147
            $.ajax({
120
            $.ajax({
148
                'dataType'  : 'json',
121
                'dataType'  : 'json',
149
                'accept'    : 'application/json',
122
                'accept'    : 'application/json',
150
                'method'    : 'post',
123
                'method'    : 'post',
151
                'url'       :  $('#form-industry').attr('action'),
124
                'url'       :  $('#form-extended').attr('action'),
152
                'data'      :  $('#form-industry').serialize()
125
                'data'      :  $('#form-extended').serialize()
153
            }).done(function(response) {
126
            }).done(function(response) {
154
                if(response['success']) {
127
                if(response['success']) {
155
 
128
 
156
                    $('#overview-industry').html(response['data']);
129
                    $('#overview-description').html(response['data']['description']);
157
                    $("#industry-box").modal('hide');
130
                    $("#extended-box").modal('hide');
158
                } else {
131
                } else {
159
                    validatorIndustry.resetForm();
132
                    validatorExtended.resetForm();
Línea 176... Línea 149...
176
        
149
        
177
        }
150
        }
Línea 178... Línea 151...
178
    });
151
    });
179
 
152
 
Línea 180... Línea 153...
180
 
153
 
181
    $('.btn-industry-edit').on("click", function(e){
154
    $('.btn-extended-edit').on("click", function(e){
182
        e.preventDefault();
155
        e.preventDefault();
183
 
156
 
184
        NProgress.start();
157
        NProgress.start();
185
        $.ajax({
158
        $.ajax({
186
            'dataType'  : 'json',
159
            'dataType'  : 'json',
187
            'accept'    : 'application/json',
160
            'accept'    : 'application/json',
188
            'method'    : 'get',
161
            'method'    : 'get',
189
            'url'       : '$routeIndustry',
-
 
190
        }).done(function(response) {
162
            'url'       : '$routeExtended',
Línea 191... Línea 163...
191
           if(response['success']) {
163
        }).done(function(response) {
192
				$('#form-industry #industry_id').val(response['data']['industry_id']).trigger('change');
164
           if(response['success']) {
193
           
165
                CKEDITOR.instances.description.setData(response['data']['description']);
194
                validatorIndustry.resetForm();
166
                validatorExtended.resetForm();
195
 
167
 
196
                $("#industry-box").modal('show');
168
                $("#extended-box").modal('show');
Línea 204... Línea 176...
204
        });
176
        });
205
        return false;
177
        return false;
Línea 206... Línea 178...
206
 
178
 
Línea 207... Línea 179...
207
    });
179
    });
208
    
180
    
Línea 209... Línea 181...
209
    $('.btn-industry-close').on("click", function(e){
181
    $('.btn-extended-close').on("click", function(e){
210
        e.preventDefault();
182
        e.preventDefault();
211
        
183
        
Línea -... Línea 184...
-
 
184
        $("#extended-box").modal('hide');
-
 
185
        return false;
212
        $("#industry-box").modal('hide');
186
    });
Línea -... Línea 187...
-
 
187
    
213
        return false;
188
    CKEDITOR.replace('description');
214
    });
189
    
Línea 215... Línea 190...
215
    
190
});
-
 
191
 
216
});
192
 
217
 
193
JS;
218
JS;
194
$this->inlineScript()->captureEnd();
219
$this->inlineScript()->captureEnd();
195
 
220
 
196
$jsonLocations = json_encode($locations);
Línea 242... Línea 218...
242
    companySize: "$company_size",
218
    companySize: "$company_size",
243
    companyName: "$company_name",
219
    companyName: "$company_name",
244
    foundationYear: "$foundation_year",
220
    foundationYear: "$foundation_year",
245
    website: "$website",
221
    website: "$website",
246
    header: "$header",
222
    header: "$header",
247
    footer: "$footer",
223
    footer: "$footer"
248
    googleApiKey: "$google_map_key"
-
 
249
}
224
}
250
JS;
225
JS;
Línea 251... Línea 226...
251
 
226
 
252
$this->inlineScript()->appendScript($js);
227
$this->inlineScript()->appendScript($js);
Línea 275... Línea 250...
275
</style>
250
</style>
Línea 276... Línea 251...
276
 
251
 
277
<!-- Content Header (Page header) -->
252
<!-- Content Header (Page header) -->
278
<div id="profile">
253
<div id="profile">
279
</div>
-
 
280
<div class="modal" tabindex="-1" role="dialog" id="industry-box">
-
 
281
    <div class="modal-dialog" role="document">
-
 
282
        <?php
-
 
283
        $form = $this->formIndustry;
-
 
284
        $form->setAttributes([
-
 
285
            'method' => 'post',
-
 
286
            'action' => $routeIndustry,
-
 
287
            'name' => 'form-industry',
-
 
288
            'id' => 'form-industry'
-
 
289
        ]);
-
 
290
        $form->prepare();
-
 
291
        echo $this->form()->openTag($form);
-
 
292
        ?>
-
 
293
        <div class="modal-content">
-
 
294
            <div class="modal-header">
-
 
295
                <h3 class="modal-title">LABEL_CHANGE</h3>
-
 
296
            </div>
-
 
297
            <div class="modal-body">
-
 
298
                <div class="form-group">
-
 
299
                    <?php
-
 
300
                    $element = $form->get('industry_id');
-
 
301
                    $element->setAttributes(['class' => 'form-control']);
-
 
302
                    $element->setOptions(['label' => 'LABEL_INDUSTRY']);
-
 
303
                    echo $this->formLabel($element);
-
 
304
                    echo $this->formSelect($element);
-
 
305
                    ?>
-
 
306
                </div>
-
 
307
            </div>
-
 
308
            <div class="modal-footer">
-
 
309
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
310
                <button type="button" class="btn btn-default btn-industry-close">LABEL_CANCEL</button>
-
 
311
            </div>
-
 
312
            <?php echo $this->form()->closeTag($form); ?>
-
 
313
        </div>
-
 
314
    </div>
254
</div>
315
</div>
255
 
316
<div class="modal" tabindex="-1" role="dialog" id="company-size-box">
256
<div class="modal" tabindex="-1" role="dialog" id="extended-box">
317
    <div class="modal-dialog" role="document">
257
    <div class="modal-dialog" role="document">
318
        <?php
258
        <?php
319
        $form = $this->formCompanySize;
259
        $form = $this->formExtended;
320
        $form->setAttributes([
260
        $form->setAttributes([
321
            'method' => 'post',
261
            'method' => 'post',
322
            'action' => $routeCompanySize,
262
            'action' => $routeExtended,
323
            'name' => 'form-company-size',
263
            'name' => 'form-extended',
324
            'id' => 'form-company-size'
264
            'id' => 'form-extended'
325
        ]);
265
        ]);
326
        $form->prepare();
266
        $form->prepare();
327
        echo $this->form()->openTag($form);
267
        echo $this->form()->openTag($form);
328
        ?>
268
        ?>
Línea 331... Línea 271...
331
                <h3 class="modal-title">LABEL_CHANGE</h3>
271
                <h3 class="modal-title">LABEL_CHANGE</h3>
332
            </div>
272
            </div>
333
            <div class="modal-body">
273
            <div class="modal-body">
334
                <div class="form-group">
274
                <div class="form-group">
335
                    <?php
275
                    <?php
336
                    $element = $form->get('company_size_id');
276
                    $element = $form->get('description');
337
                    $element->setAttributes(['class' => 'form-control']);
277
                    $element->setAttributes(['class' => 'form-control']);
338
                    $element->setOptions(['label' => 'LABEL_COMPANY_SIZE']);
278
                    $element->setOptions(['label' => 'LABEL_OVERVIEW']);
339
                    echo $this->formLabel($element);
279
                    echo $this->formLabel($element);
340
                    echo $this->formSelect($element);
280
                    echo $this->formTextArea($element);
341
                    ?>
281
                    ?>
342
                </div>
282
                </div>
343
            </div>
283
            </div>
344
            <div class="modal-footer">
284
            <div class="modal-footer">
345
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
285
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
346
                <button type="button" class="btn btn-default btn-company-size-close">LABEL_CANCEL</button>
286
                <button type="button" class="btn btn-default btn-extended-close">LABEL_CANCEL</button>
347
            </div>
287
            </div>
348
            <?php echo $this->form()->closeTag($form); ?>
288
            <?php echo $this->form()->closeTag($form); ?>
349
        </div>
289
        </div>
350
    </div>
290
    </div>
351
</div>
291
</div>
352
292