Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6583 Rev 7773
Línea 22... Línea 22...
22
$routeImageUpload = $this->url('profile/image', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
22
$routeImageUpload = $this->url('profile/image', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
23
$routeCoverUpload = $this->url('profile/cover', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
23
$routeCoverUpload = $this->url('profile/cover', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
24
$routeFooterUpload = $this->url('profile/footer', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
24
$routeFooterUpload = $this->url('profile/footer', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
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
 
-
 
27
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
-
 
28
 
26
 
29
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
27
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
Línea 30... Línea -...
30
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
31
 
-
 
32
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
-
 
33
 
-
 
34
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
35
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
36
 
29
 
37
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
Línea 53... Línea 46...
53
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
46
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
Línea 54... Línea 47...
54
 
47
 
55
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
Línea 56... Línea -...
56
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
-
 
57
 
-
 
58
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
-
 
59
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
-
 
60
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
61
 
50
 
62
$this->inlineScript()->captureStart();
51
$this->inlineScript()->captureStart();
Línea 63... Línea -...
63
echo <<<JS
-
 
64
jQuery( document ).ready(function( $ ) {
-
 
65
 
-
 
66
    $.validator.addMethod('greaterThan', function (value, element, param) {
-
 
67
        var otherElement = $(param);
-
 
68
        return parseInt(value, 10) > parseInt(otherElement.val(), 10);
-
 
69
    }, 'ERROR_INVALID_MINIMUM');
-
 
70
 
-
 
71
    $.validator.addMethod('checkLocation', function (value, element, param) {
-
 
72
        var otherElement = $(param);
-
 
73
        return $.trim(otherElement.val()).length > 0;
-
 
74
    }, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
-
 
75
 
-
 
76
    var autocompleteLocation = new google.maps.places.Autocomplete(
-
 
77
        (document.getElementById('location_search')),
-
 
78
        {types: ['(cities)']}
-
 
79
    );
-
 
80
 
-
 
81
 
-
 
82
    $.fn.fillInAddressLocation = function() {
-
 
83
        console.log('fillInAddressLocation');
-
 
84
 
-
 
85
        var place = autocompleteLocation.getPlace();
-
 
86
        if (!place.geometry) {
-
 
87
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
-
 
88
            return;
-
 
89
        } else {
-
 
90
        address1 = '';
-
 
91
        address2 = '';
-
 
92
        city1 = '';
-
 
93
        city2 = '';
-
 
94
        state = '';
-
 
95
        country = '';
-
 
96
        postal_code = '';
-
 
97
 
-
 
98
        formatted_address = place.formatted_address;
-
 
99
        latitude = place.geometry.location.lat();
-
 
100
        longitude = place.geometry.location.lng();
-
 
101
        var arrAddress = place.address_components;
-
 
102
            
-
 
103
        $.each(arrAddress, function(i, address_component) {
-
 
104
            if (address_component.types[0] == "route") {
-
 
105
                address1 = address_component.long_name;
-
 
106
            }
-
 
107
            if (address_component.types[0] == "sublocality") {
-
 
108
                address2 = address_component.long_name;
-
 
109
            }
-
 
110
            if (address_component.types[0] == "locality") {
-
 
111
                city1 = address_component.long_name;
-
 
112
            }
-
 
113
            if (address_component.types[0] == "administrative_area_level_2") {
-
 
114
                city2 = address_component.long_name;
-
 
115
            }
-
 
116
            if (address_component.types[0] == "administrative_area_level_1") {
-
 
117
                state = address_component.long_name;
-
 
118
            }
-
 
119
            if (address_component.types[0] == "country") {
-
 
120
                country = address_component.long_name;
-
 
121
            }
-
 
122
            if (address_component.types[0] == "postal_code") {
-
 
123
                postal_code = address_component.long_name;
-
 
124
            }
-
 
125
        });
-
 
126
 
-
 
127
        $('#form-location #formatted_address').val(formatted_address);
-
 
128
        $('#form-location #address1').val(address1);
-
 
129
        $('#form-location #address2').val(address2);
-
 
130
        $('#form-location #city1').val(city1);
-
 
131
        $('#form-location #city2').val(city2);
-
 
132
        $('#form-location #state').val(state);
-
 
133
        $('#form-location #country').val(country);
-
 
134
        $('#form-location #postal_code').val(postal_code);
-
 
135
        $('#form-location #latitude').val(latitude);
-
 
136
        $('#form-location #longitude').val(longitude);
-
 
137
 
-
 
138
        }
-
 
139
    }
-
 
140
 
-
 
141
    $.fn.renderLocation = function(data) {
-
 
142
        $('#locations-records').empty();
-
 
143
        if(Array.isArray(data)) {
-
 
144
            max = data.length;
-
 
145
            for(i = 0; i < max; i++)
-
 
146
            {
-
 
147
                var location = data[i];
-
 
148
                s = '<p>' + location['formatted_address']; 
-
 
149
                if(location['is_main'] == 'y') {
-
 
150
                    s = s + ' (LABEL_MAIN_LOCATION) '; 
-
 
151
                }
-
 
152
                s = s + ' <a href="#" title="" data-link="' + location['link_edit'] + '" class="btn-location-edit"><i class="fa fa-pencil"></i></a>&nbsp; ';
-
 
153
                s = s + ' <a href="#" title="" data-link="' + location['link_delete'] + '" class="btn-location-delete"><i class="fa fa-trash"></i></a>';
-
 
154
                s = s + ' </p>';
-
 
155
 
-
 
156
                if(i < (max - 1)) { 
-
 
157
                    s = s + '<hr/>'; 
-
 
158
                }
-
 
159
                $('#locations-records').append(s);
-
 
160
            }      
-
 
161
        }
-
 
162
    }
-
 
163
 
-
 
164
            $.validator.setDefaults({
-
 
165
            debug: true,
-
 
166
            highlight: function(element) {
-
 
167
                $(element).addClass('is-invalid');
-
 
168
            },
-
 
169
            unhighlight: function(element) {
-
 
170
                $(element).removeClass('is-invalid');
-
 
171
            },
-
 
172
            errorElement: 'span',
-
 
173
            errorClass: 'error invalid-feedback',
-
 
174
            errorPlacement: function(error, element) {
-
 
175
                if(element.parent('.form-group').length) {
-
 
176
                    error.insertAfter(element);
-
 
177
                } else if(element.parent('.toggle').length) {
-
 
178
                    error.insertAfter(element.parent().parent());
-
 
179
                } else {
-
 
180
                    error.insertAfter(element.parent());
-
 
181
                }
-
 
182
            }
-
 
183
        });
-
 
184
    
-
 
185
        $.fn.showFormErrorValidator = function(fieldname, errors) {
-
 
186
            var field = $(fieldname);
-
 
187
            if(field) {
-
 
188
                $(field).addClass('is-invalid');
-
 
189
    
-
 
190
 
-
 
191
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
-
 
192
                if(field.parent('.form-group').length) {
-
 
193
                    error.insertAfter(field);
-
 
194
                } else  if(field.parent('.toggle').length) {
-
 
195
                    error.insertAfter(field.parent().parent());
-
 
196
                } else {
-
 
197
                    error.insertAfter(field.parent());
-
 
198
                }
-
 
199
            }
-
 
200
        };
-
 
201
   
-
 
202
    var validatorLocation = $('#form-location').validate({
-
 
203
        debug: true,
-
 
204
        onclick: false,
-
 
205
        onkeyup: false,
-
 
206
        onfocusout: false,
-
 
207
        ignore: [],
-
 
208
        rules: {
-
 
209
            'location_search': {
-
 
210
                required: true,
-
 
211
                checkLocation: '#form-location #latitude'
-
 
212
            }
-
 
213
        },
-
 
214
        submitHandler: function(form)
-
 
215
        {
-
 
216
            NProgress.start();
-
 
217
            $.ajax({
-
 
218
                'dataType'  : 'json',
-
 
219
                'accept'    : 'application/json',
-
 
220
                'method'    : 'post',
-
 
221
                'url'       :  $('#form-location').attr('action'),
-
 
222
                'data'      :  $('#form-location').serialize(),
-
 
223
            }).done(function(response) {
-
 
224
                if(response['success']) {
-
 
225
                    $.fn.renderLocation(response['data']);
-
 
226
        						
-
 
227
                    $("#location-box").modal('hide');
-
 
228
                } else {
-
 
229
                    validatorLocation.resetForm();
-
 
230
                    $.fn.showError(response['data']);
-
 
231
                }
-
 
232
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
233
                $.fn.showError(textStatus);
-
 
234
            }).always(function() {
-
 
235
                NProgress.done();
-
 
236
            });
-
 
237
            return false;
-
 
238
        },
-
 
239
        invalidHandler: function(form, validator) {
-
 
240
        
-
 
241
        }
-
 
242
    });
-
 
243
 
-
 
244
    $('.btn-location-add').on("click", function(e){
-
 
245
        e.preventDefault();
-
 
246
 
-
 
247
        $('#form-location').attr('action', '$routeLocationAdd');
-
 
248
        $('#form-location #location_search').val('');
-
 
249
        $('#form-location #formatted_address').val('');
-
 
250
        $('#form-location #address1').val('');
-
 
251
        $('#form-location #address2').val('');
-
 
252
        $('#form-location #country').val('');
-
 
253
        $('#form-location #state').val('');
-
 
254
        $('#form-location #city1').val('');
-
 
255
        $('#form-location #city2').val('');
-
 
256
        $('#form-location #postal_code').val('');
-
 
257
        $('#form-location #latitude').val('');
-
 
258
        $('#form-location #longitude').val('');
-
 
259
        validatorLocation.resetForm();
-
 
260
 
-
 
261
        $("#location-box").modal('show');
-
 
262
    });
-
 
263
 
-
 
264
    $('body').on('click', 'a.btn-location-edit', function(e) {
-
 
265
        e.preventDefault();
-
 
266
 
-
 
267
        var url = $(this).data('link');
-
 
268
 
-
 
269
        NProgress.start();
-
 
270
        $.ajax({
-
 
271
            'dataType'  : 'json',
-
 
272
            'accept'    : 'application/json',
-
 
273
            'method'    : 'get',
-
 
274
            'url'       : url,
-
 
275
        }).done(function(response) {
-
 
276
           if(response['success']) {
-
 
277
                $('#form-location').attr('action', url);
-
 
278
                $('#form-location #location_search').val(response['data']['formatted_address']);
-
 
279
                $('#form-location #formatted_address').val(response['data']['formatted_address']);
-
 
280
                $('#form-location #address1').val(response['data']['address1']);
-
 
281
                $('#form-location #address2').val(response['data']['address2']);
-
 
282
                $('#form-location #country').val(response['data']['country']);
-
 
283
                $('#form-location #state').val(response['data']['state']);
-
 
284
                $('#form-location #city1').val(response['data']['city1']);
-
 
285
                $('#form-location #city2').val(response['data']['city2']);
-
 
286
                $('#form-location #postal_code').val(response['data']['postal_code']);
-
 
287
                $('#form-location #latitude').val(response['data']['latitude']);
-
 
288
                $('#form-location #longitude').val(response['data']['longitude']);
-
 
289
 
-
 
290
                if(response['data']['is_main'] == 'y') {
-
 
291
                    $('#form-location #is_main').bootstrapToggle('on')
-
 
292
                } else {
-
 
293
                    $('#form-location #is_main').bootstrapToggle('off')
-
 
294
                }
-
 
295
 
-
 
296
                validatorLocation.resetForm();
-
 
297
        
-
 
298
                $("#location-box").modal('show');
-
 
299
            } else {
-
 
300
                $.fn.showError(response['data']);
-
 
301
            }
-
 
302
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
303
            $.fn.showError(textStatus);
-
 
304
        }).always(function() {
-
 
305
            NProgress.done();
-
 
306
        });
-
 
307
        return false;
-
 
308
 
-
 
309
 
-
 
310
    });
-
 
311
 
-
 
312
    $('body').on('click', 'a.btn-location-delete', function(e) {
-
 
313
        e.preventDefault();
-
 
314
 
-
 
315
        var url = $(this).data('link');
-
 
316
 
-
 
317
        NProgress.start();
-
 
318
        $.ajax({
-
 
319
            'dataType'  : 'json',
-
 
320
            'accept'    : 'application/json',
-
 
321
            'method'    : 'post',
-
 
322
            'url'       : url,
-
 
323
        }).done(function(response) {
-
 
324
           if(response['success']) {
-
 
325
                $.fn.renderLocation(response['data']);
-
 
326
            } else {
-
 
327
                $.fn.showError(response['data']);
-
 
328
            }
-
 
329
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
330
            $.fn.showError(textStatus);
-
 
331
        }).always(function() {
-
 
332
            NProgress.done();
-
 
333
        });
-
 
334
        return false;
-
 
335
 
-
 
336
 
-
 
337
    });
-
 
338
 
-
 
339
    
-
 
340
    $('.btn-location-close').on("click", function(e){
-
 
341
        e.preventDefault();
-
 
342
        
-
 
343
        $("#location-box").modal('hide');
-
 
344
        return false;
52
echo <<<JS
345
    });
53
jQuery( document ).ready(function( $ ) {
346
 
54
 
347
	var validatorCompanySize = $('#form-company-size').validate({
55
	var validatorCompanySize = $('#form-company-size').validate({
348
        debug: true,
56
        debug: true,
Línea 509... Línea 217...
509
        e.preventDefault();
217
        e.preventDefault();
Línea 510... Línea 218...
510
        
218
        
511
        $("#industry-box").modal('hide');
219
        $("#industry-box").modal('hide');
512
        return false;
220
        return false;
513
    });
-
 
514
 
-
 
515
    $("#form-cover #cover").fileinput({
-
 
516
        theme: 'fas',
-
 
517
        language: 'es',
-
 
518
        showUpload: false,
-
 
519
        dropZoneEnabled: false,
-
 
520
        maxFileCount: 1,
-
 
521
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'gif'],
-
 
522
        mainClass: "input-group",
-
 
523
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size_cover',
-
 
524
    });
-
 
525
 
-
 
526
    CKEDITOR.replace('description');
-
 
527
 
-
 
528
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
-
 
529
 
-
 
Línea 530... Línea 221...
530
    $('#form-location #is_main').bootstrapToggle({'on' : 'LABEL_MAIN_LOCATION',  'off' : 'LABEL_SECONDARY_LOCATION', 'width' : '160px', 'height' : '40px'});
221
    });
Línea 531... Línea 222...
531
    
222
    
532
});
223
});
Línea 661... Línea 352...
661
                <button type="button" class="btn btn-default btn-company-size-close">LABEL_CANCEL</button>
352
                <button type="button" class="btn btn-default btn-company-size-close">LABEL_CANCEL</button>
662
            </div>
353
            </div>
663
            <?php echo $this->form()->closeTag($form); ?>
354
            <?php echo $this->form()->closeTag($form); ?>
664
        </div>
355
        </div>
665
    </div>
356
    </div>
666
</div>
-
 
667
<div class="modal" tabindex="-1" role="dialog" id="location-box">
-
 
668
    <div class="modal-dialog" role="document">
-
 
669
        <?php
-
 
670
        $form = $this->formLocation;
-
 
671
        $form->setAttributes([
-
 
672
            'method' => 'post',
-
 
673
            'action' => '',
-
 
674
            'name' => 'form-location',
-
 
675
            'id' => 'form-location'
-
 
676
        ]);
-
 
677
        $form->prepare();
-
 
678
        echo $this->form()->openTag($form);
-
 
679
 
-
 
680
        $fieldnames = [
-
 
681
            'formatted_address',
-
 
682
            'address1',
-
 
683
            'address2',
-
 
684
            'country',
-
 
685
            'state',
-
 
686
            'city1',
-
 
687
            'city2',
-
 
688
            'postal_code',
-
 
689
            'latitude',
-
 
690
            'longitude',
-
 
691
        ];
-
 
692
 
-
 
693
        foreach ($fieldnames as $fieldname) {
-
 
694
 
-
 
695
            $element = $form->get($fieldname);
-
 
696
            echo $this->formHidden($element);
-
 
697
        }
-
 
698
        ?>
-
 
699
        <div class="modal-content">
-
 
700
            <div class="modal-header">
-
 
701
                <h3 class="modal-title">LABEL_CHANGE</h3>
-
 
702
            </div>
-
 
703
            <div class="modal-body">
-
 
704
                <div class="form-group datefm">
-
 
705
                    <?php
-
 
706
                    $element = $form->get('location_search');
-
 
707
                    $element->setAttributes(['class' => 'form-control']);
-
 
708
                    $element->setOptions(['label' => 'LABEL_LOCATION']);
-
 
709
                    echo $this->formLabel($element);
-
 
710
                    echo $this->formText($element);
-
 
711
                    ?>
-
 
712
                    <i class="fa fa-map-marker"></i>
-
 
713
                </div>
-
 
714
                <div class="form-group">
-
 
715
                    <?php
-
 
716
                    $element = $form->get('is_main');
-
 
717
                    echo $this->formCheckbox($element);
-
 
718
                    ?>
-
 
719
                </div>
-
 
720
            </div>
-
 
721
            <div class="modal-footer">
-
 
722
                <button type="submit" class="btn btn-primary ">LABEL_SAVE</button>
-
 
723
                <button type="button" class="btn btn-default btn-location-close">LABEL_CANCEL</button>
-
 
724
            </div>
-
 
725
            <?php echo $this->form()->closeTag($form); ?>
-
 
726
        </div>
-
 
727
    </div>
-
 
728
</div>
357
</div>
729
358