Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6583 | Rev 7774 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
 
3
use LeadersLinked\Model\UserExperience;
4
 
5
$acl = $this->viewModel()
6
    ->getRoot()
7
    ->getVariable('acl');
8
$currentUserHelper = $this->currentUserHelper();
9
$currentUser = $currentUserHelper->getUser();
10
$currentCompany = $currentUserHelper->getCompany();
5761 stevensc 11
$companyId = $currentCompany->uuid;
1 www 12
 
13
$roleName = $currentUserHelper->getUserTypeId();
14
 
5743 stevensc 15
$routeWebsite = $this->url('profile/website', ['id' => $currentCompany->uuid]);
16
$routeCompanySize = $this->url('profile/company-size', ['id' => $currentCompany->uuid]);
17
$routeIndustry = $this->url('profile/industry', ['id' => $currentCompany->uuid]);
18
$routeExtended = $this->url('profile/extended', ['id' => $currentCompany->uuid]);
19
$routeSocialNetworks = $this->url('profile/social-network', ['id' => $currentCompany->uuid]);
20
$routeLocationAdd = $this->url('profile/location', ['id' => $currentCompany->uuid, 'operation' => 'add']);
21
$routeFoundationYear = $this->url('profile/foundation_year', ['id' => $currentCompany->uuid, 'operation' => 'add']);
22
$routeImageUpload = $this->url('profile/image', ['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']);
25
$routeHeaderUpload = $this->url('profile/header', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
1 www 26
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
28
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
29
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
33
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
34
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
35
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
36
 
37
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
39
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
40
 
41
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
42
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
43
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.min.js'));
44
 
45
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.min.js'));
46
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
47
 
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
50
 
51
$this->inlineScript()->captureStart();
52
echo <<<JS
53
jQuery( document ).ready(function( $ ) {
54
 
6486 stevensc 55
	var validatorCompanySize = $('#form-company-size').validate({
56
        debug: true,
57
        onclick: false,
58
        onkeyup: false,
59
        onfocusout: false,
60
        ignore: [],
61
        rules: {
62
            'company_size_id': {
63
                required: true,
64
            },
65
        },
66
 
67
        submitHandler: function(form)
68
        {
69
            NProgress.start();
70
            $.ajax({
71
                'dataType'  : 'json',
72
                'accept'    : 'application/json',
73
                'method'    : 'post',
74
                'url'       :  $('#form-company-size').attr('action'),
75
                'data'      :  $('#form-company-size').serialize()
76
            }).done(function(response) {
77
                if(response['success']) {
78
 
79
                    $('#overview-company-size').html(response['data']);
80
                    $("#company-size-box").modal('hide');
81
                } else {
82
                    validatorCompanySize.resetForm();
83
                    if(jQuery.type(response['data']) == 'string') {
84
                        $.fn.showError(response['data']);
85
                    } else  {
86
                        $.each(response['data'], function( fieldname, errors ) {
87
                            $.fn.showFormErrorValidator('#form-company-size #' + fieldname, errors);
88
                        });
89
                    }
90
                }
91
            }).fail(function( jqXHR, textStatus, errorThrown) {
92
                $.fn.showError(textStatus);
93
            }).always(function() {
94
                NProgress.done();
95
            });
96
            return false;
97
        },
98
        invalidHandler: function(form, validator) {
99
 
100
        }
101
    });
102
 
103
 
104
    $('.btn-company-size-edit').on("click", function(e){
105
        e.preventDefault();
106
 
107
        NProgress.start();
108
        $.ajax({
109
            'dataType'  : 'json',
110
            'accept'    : 'application/json',
111
            'method'    : 'get',
112
            'url'       : '$routeCompanySize',
113
        }).done(function(response) {
114
           if(response['success']) {
115
				$('#form-company-size #company_size_id').val(response['data']['company_size_id']).trigger('change');
116
 
117
                validatorCompanySize.resetForm();
118
 
119
                $("#company-size-box").modal('show');
120
            } else {
121
                $.fn.showError(response['data']);
122
            }
123
        }).fail(function( jqXHR, textStatus, errorThrown) {
124
            $.fn.showError(textStatus);
125
        }).always(function() {
126
            NProgress.done();
127
        });
128
        return false;
129
 
130
    });
131
 
132
    $('.btn-company-size-close').on("click", function(e){
133
        e.preventDefault();
134
 
135
        $("#company-size-box").modal('hide');
136
        return false;
137
    });
138
 
1 www 139
	var validatorIndustry = $('#form-industry').validate({
140
        debug: true,
141
        onclick: false,
142
        onkeyup: false,
143
        onfocusout: false,
144
        ignore: [],
145
        rules: {
146
            'industry_id': {
147
                required: true,
148
            },
149
        },
150
 
151
        submitHandler: function(form)
152
        {
153
            NProgress.start();
154
            $.ajax({
155
                'dataType'  : 'json',
156
                'accept'    : 'application/json',
157
                'method'    : 'post',
158
                'url'       :  $('#form-industry').attr('action'),
159
                'data'      :  $('#form-industry').serialize()
160
            }).done(function(response) {
161
                if(response['success']) {
162
 
163
                    $('#overview-industry').html(response['data']);
164
                    $("#industry-box").modal('hide');
165
                } else {
166
                    validatorIndustry.resetForm();
167
                    if(jQuery.type(response['data']) == 'string') {
168
                        $.fn.showError(response['data']);
169
                    } else  {
170
                        $.each(response['data'], function( fieldname, errors ) {
171
                            $.fn.showFormErrorValidator('#form-industry #' + fieldname, errors);
172
                        });
173
                    }
174
                }
175
            }).fail(function( jqXHR, textStatus, errorThrown) {
176
                $.fn.showError(textStatus);
177
            }).always(function() {
178
                NProgress.done();
179
            });
180
            return false;
181
        },
182
        invalidHandler: function(form, validator) {
183
 
184
        }
185
    });
186
 
187
 
188
    $('.btn-industry-edit').on("click", function(e){
189
        e.preventDefault();
190
 
191
        NProgress.start();
192
        $.ajax({
193
            'dataType'  : 'json',
194
            'accept'    : 'application/json',
195
            'method'    : 'get',
196
            'url'       : '$routeIndustry',
197
        }).done(function(response) {
198
           if(response['success']) {
199
				$('#form-industry #industry_id').val(response['data']['industry_id']).trigger('change');
200
 
201
                validatorIndustry.resetForm();
202
 
203
                $("#industry-box").modal('show');
204
            } else {
205
                $.fn.showError(response['data']);
206
            }
207
        }).fail(function( jqXHR, textStatus, errorThrown) {
208
            $.fn.showError(textStatus);
209
        }).always(function() {
210
            NProgress.done();
211
        });
212
        return false;
213
 
214
    });
215
 
216
    $('.btn-industry-close').on("click", function(e){
217
        e.preventDefault();
218
 
219
        $("#industry-box").modal('hide');
220
        return false;
221
    });
222
 
223
});
224
 
225
JS;
226
$this->inlineScript()->captureEnd();
227
 
6005 stevensc 228
$jsonLocations = json_encode($locations);
5743 stevensc 229
$js = <<<JS
230
const urlVars = {
231
    routeWebsite: "$routeWebsite",
232
    routeCompanySize: "$routeCompanySize",
233
    routeIndustry: "$routeIndustry",
234
    routeExtended: "$routeExtended",
235
    routeSocialNetworks: "$routeSocialNetworks",
236
    routeLocationAdd: "$routeLocationAdd",
237
    routeFoundationYear: "$routeFoundationYear",
238
    routeImageUpload: "$routeImageUpload",
239
    routeCoverUpload: "$routeCoverUpload",
240
    routeFooterUpload: "$routeFooterUpload",
5757 stevensc 241
    routeHeaderUpload: "$routeHeaderUpload",
242
    cover: "$cover",
5795 stevensc 243
    companyId: "$companyId",
5925 stevensc 244
    followers: "$follower",
5988 stevensc 245
    image: "$image",
6002 stevensc 246
    overview: "$overview",
6025 stevensc 247
    locations: JSON.parse('$jsonLocations'),
6026 stevensc 248
    industry: "$industry",
6027 stevensc 249
    companySize: "$company_size",
6050 stevensc 250
    companyName: "$company_name",
251
    foundationYear: "$foundation_year",
6055 stevensc 252
    website: "$website",
6059 stevensc 253
    header: "$header",
254
    footer: "$footer"
5743 stevensc 255
}
256
JS;
257
 
258
$this->inlineScript()->appendScript($js);
6448 stevensc 259
$this->headLink()->appendStylesheet('/react-bundles/profile/main.css');
5743 stevensc 260
$this->inlineScript()->appendFile('/react-bundles/profile/profileBundle.js');
1 www 261
?>
262
 
777 geraldo 263
<style>
5743 stevensc 264
    .user-profile-ov {
265
        position: relative;
266
    }
777 geraldo 267
 
5743 stevensc 268
    .user-profile-ov .add-dp {
269
        position: absolute;
270
        top: 30%;
271
        right: 10%;
272
    }
779 geraldo 273
 
5743 stevensc 274
    .user-profile-ov .add-dp i {
275
        font-size: 14px;
276
        border: 2px solid #fff;
277
        background: #e44d3a;
278
        padding: 11px;
279
        color: #ffff
280
    }
777 geraldo 281
</style>
282
 
1 www 283
<!-- Content Header (Page header) -->
5743 stevensc 284
<div id="profile">
5800 stevensc 285
</div>
1 www 286
<div class="modal" tabindex="-1" role="dialog" id="industry-box">
5743 stevensc 287
    <div class="modal-dialog" role="document">
288
        <?php
289
        $form = $this->formIndustry;
290
        $form->setAttributes([
291
            'method' => 'post',
292
            'action' => $routeIndustry,
293
            'name' => 'form-industry',
294
            'id' => 'form-industry'
295
        ]);
296
        $form->prepare();
297
        echo $this->form()->openTag($form);
298
        ?>
299
        <div class="modal-content">
300
            <div class="modal-header">
301
                <h3 class="modal-title">LABEL_CHANGE</h3>
770 geraldo 302
            </div>
5743 stevensc 303
            <div class="modal-body">
304
                <div class="form-group">
305
                    <?php
306
                    $element = $form->get('industry_id');
307
                    $element->setAttributes(['class' => 'form-control']);
308
                    $element->setOptions(['label' => 'LABEL_INDUSTRY']);
309
                    echo $this->formLabel($element);
310
                    echo $this->formSelect($element);
311
                    ?>
312
                </div>
313
            </div>
314
            <div class="modal-footer">
315
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
316
                <button type="button" class="btn btn-default btn-industry-close">LABEL_CANCEL</button>
317
            </div>
318
            <?php echo $this->form()->closeTag($form); ?>
319
        </div>
320
    </div>
1 www 321
</div>
322
<div class="modal" tabindex="-1" role="dialog" id="company-size-box">
5743 stevensc 323
    <div class="modal-dialog" role="document">
324
        <?php
325
        $form = $this->formCompanySize;
326
        $form->setAttributes([
327
            'method' => 'post',
328
            'action' => $routeCompanySize,
329
            'name' => 'form-company-size',
330
            'id' => 'form-company-size'
331
        ]);
332
        $form->prepare();
333
        echo $this->form()->openTag($form);
334
        ?>
335
        <div class="modal-content">
336
            <div class="modal-header">
337
                <h3 class="modal-title">LABEL_CHANGE</h3>
770 geraldo 338
            </div>
5743 stevensc 339
            <div class="modal-body">
340
                <div class="form-group">
341
                    <?php
342
                    $element = $form->get('company_size_id');
343
                    $element->setAttributes(['class' => 'form-control']);
344
                    $element->setOptions(['label' => 'LABEL_COMPANY_SIZE']);
345
                    echo $this->formLabel($element);
346
                    echo $this->formSelect($element);
347
                    ?>
348
                </div>
349
            </div>
350
            <div class="modal-footer">
351
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
352
                <button type="button" class="btn btn-default btn-company-size-close">LABEL_CANCEL</button>
353
            </div>
354
            <?php echo $this->form()->closeTag($form); ?>
355
        </div>
356
    </div>
6060 stevensc 357
</div>