Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 8523 | Rev 8525 | 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/jquery-validation/jquery.validate.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
33
 
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
 
8523 stevensc 38
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.min.js'));
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
40
 
1 www 41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
43
 
44
$this->inlineScript()->captureStart();
45
echo <<<JS
46
jQuery( document ).ready(function( $ ) {
47
 
8524 stevensc 48
	var validatorCompanySize = $('#form-company-size').validate({
8523 stevensc 49
        debug: true,
50
        onclick: false,
51
        onkeyup: false,
52
        onfocusout: false,
53
        ignore: [],
54
        rules: {
8524 stevensc 55
            'company_size_id': {
8523 stevensc 56
                required: true,
57
            },
58
        },
59
 
60
        submitHandler: function(form)
61
        {
62
            NProgress.start();
63
            $.ajax({
64
                'dataType'  : 'json',
65
                'accept'    : 'application/json',
66
                'method'    : 'post',
8524 stevensc 67
                'url'       :  $('#form-company-size').attr('action'),
68
                'data'      :  $('#form-company-size').serialize()
8523 stevensc 69
            }).done(function(response) {
70
                if(response['success']) {
71
 
8524 stevensc 72
                    $('#overview-company-size').html(response['data']);
73
                    $("#company-size-box").modal('hide');
8523 stevensc 74
                } else {
8524 stevensc 75
                    validatorCompanySize.resetForm();
8523 stevensc 76
                    if(jQuery.type(response['data']) == 'string') {
77
                        $.fn.showError(response['data']);
78
                    } else  {
79
                        $.each(response['data'], function( fieldname, errors ) {
8524 stevensc 80
                            $.fn.showFormErrorValidator('#form-company-size #' + fieldname, errors);
8523 stevensc 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
 
8524 stevensc 97
    $('.btn-company-size-edit').on("click", function(e){
8523 stevensc 98
        e.preventDefault();
99
 
100
        NProgress.start();
101
        $.ajax({
102
            'dataType'  : 'json',
103
            'accept'    : 'application/json',
104
            'method'    : 'get',
8524 stevensc 105
            'url'       : '$routeCompanySize',
8523 stevensc 106
        }).done(function(response) {
107
           if(response['success']) {
8524 stevensc 108
				$('#form-company-size #company_size_id').val(response['data']['company_size_id']).trigger('change');
109
 
110
                validatorCompanySize.resetForm();
8523 stevensc 111
 
8524 stevensc 112
                $("#company-size-box").modal('show');
8523 stevensc 113
            } else {
114
                $.fn.showError(response['data']);
115
            }
116
        }).fail(function( jqXHR, textStatus, errorThrown) {
117
            $.fn.showError(textStatus);
118
        }).always(function() {
119
            NProgress.done();
120
        });
121
        return false;
122
 
123
    });
124
 
8524 stevensc 125
    $('.btn-company-size-close').on("click", function(e){
8523 stevensc 126
        e.preventDefault();
127
 
8524 stevensc 128
        $("#company-size-box").modal('hide');
8523 stevensc 129
        return false;
130
    });
6486 stevensc 131
 
8523 stevensc 132
	var validatorIndustry = $('#form-industry').validate({
133
        debug: true,
134
        onclick: false,
135
        onkeyup: false,
136
        onfocusout: false,
137
        ignore: [],
138
        rules: {
139
            'industry_id': {
140
                required: true,
141
            },
142
        },
143
 
144
        submitHandler: function(form)
145
        {
146
            NProgress.start();
147
            $.ajax({
148
                'dataType'  : 'json',
149
                'accept'    : 'application/json',
150
                'method'    : 'post',
151
                'url'       :  $('#form-industry').attr('action'),
152
                'data'      :  $('#form-industry').serialize()
153
            }).done(function(response) {
154
                if(response['success']) {
155
 
156
                    $('#overview-industry').html(response['data']);
157
                    $("#industry-box").modal('hide');
158
                } else {
159
                    validatorIndustry.resetForm();
160
                    if(jQuery.type(response['data']) == 'string') {
161
                        $.fn.showError(response['data']);
162
                    } else  {
163
                        $.each(response['data'], function( fieldname, errors ) {
164
                            $.fn.showFormErrorValidator('#form-industry #' + fieldname, errors);
165
                        });
166
                    }
167
                }
168
            }).fail(function( jqXHR, textStatus, errorThrown) {
169
                $.fn.showError(textStatus);
170
            }).always(function() {
171
                NProgress.done();
172
            });
173
            return false;
174
        },
175
        invalidHandler: function(form, validator) {
176
 
177
        }
178
    });
179
 
180
 
181
    $('.btn-industry-edit').on("click", function(e){
182
        e.preventDefault();
183
 
184
        NProgress.start();
185
        $.ajax({
186
            'dataType'  : 'json',
187
            'accept'    : 'application/json',
188
            'method'    : 'get',
189
            'url'       : '$routeIndustry',
190
        }).done(function(response) {
191
           if(response['success']) {
192
				$('#form-industry #industry_id').val(response['data']['industry_id']).trigger('change');
193
 
194
                validatorIndustry.resetForm();
195
 
196
                $("#industry-box").modal('show');
197
            } else {
198
                $.fn.showError(response['data']);
199
            }
200
        }).fail(function( jqXHR, textStatus, errorThrown) {
201
            $.fn.showError(textStatus);
202
        }).always(function() {
203
            NProgress.done();
204
        });
205
        return false;
206
 
207
    });
1 www 208
 
8523 stevensc 209
    $('.btn-industry-close').on("click", function(e){
210
        e.preventDefault();
211
 
212
        $("#industry-box").modal('hide');
213
        return false;
214
    });
215
 
1 www 216
});
217
 
218
JS;
219
$this->inlineScript()->captureEnd();
220
 
6005 stevensc 221
$jsonLocations = json_encode($locations);
5743 stevensc 222
$js = <<<JS
223
const urlVars = {
224
    routeWebsite: "$routeWebsite",
225
    routeCompanySize: "$routeCompanySize",
226
    routeIndustry: "$routeIndustry",
227
    routeExtended: "$routeExtended",
228
    routeSocialNetworks: "$routeSocialNetworks",
229
    routeLocationAdd: "$routeLocationAdd",
230
    routeFoundationYear: "$routeFoundationYear",
231
    routeImageUpload: "$routeImageUpload",
232
    routeCoverUpload: "$routeCoverUpload",
233
    routeFooterUpload: "$routeFooterUpload",
5757 stevensc 234
    routeHeaderUpload: "$routeHeaderUpload",
235
    cover: "$cover",
5795 stevensc 236
    companyId: "$companyId",
5925 stevensc 237
    followers: "$follower",
5988 stevensc 238
    image: "$image",
6002 stevensc 239
    overview: "$overview",
6025 stevensc 240
    locations: JSON.parse('$jsonLocations'),
6026 stevensc 241
    industry: "$industry",
6027 stevensc 242
    companySize: "$company_size",
6050 stevensc 243
    companyName: "$company_name",
244
    foundationYear: "$foundation_year",
6055 stevensc 245
    website: "$website",
6059 stevensc 246
    header: "$header",
8524 stevensc 247
    footer: "$footer",
248
    googleApiKey: "$google_map_key"
5743 stevensc 249
}
250
JS;
251
 
252
$this->inlineScript()->appendScript($js);
6448 stevensc 253
$this->headLink()->appendStylesheet('/react-bundles/profile/main.css');
5743 stevensc 254
$this->inlineScript()->appendFile('/react-bundles/profile/profileBundle.js');
1 www 255
?>
256
 
777 geraldo 257
<style>
5743 stevensc 258
    .user-profile-ov {
259
        position: relative;
260
    }
777 geraldo 261
 
5743 stevensc 262
    .user-profile-ov .add-dp {
263
        position: absolute;
264
        top: 30%;
265
        right: 10%;
266
    }
779 geraldo 267
 
5743 stevensc 268
    .user-profile-ov .add-dp i {
269
        font-size: 14px;
270
        border: 2px solid #fff;
271
        background: #e44d3a;
272
        padding: 11px;
273
        color: #ffff
274
    }
777 geraldo 275
</style>
276
 
1 www 277
<!-- Content Header (Page header) -->
5743 stevensc 278
<div id="profile">
5800 stevensc 279
</div>
8523 stevensc 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>
315
</div>
316
<div class="modal" tabindex="-1" role="dialog" id="company-size-box">
317
    <div class="modal-dialog" role="document">
318
        <?php
319
        $form = $this->formCompanySize;
320
        $form->setAttributes([
321
            'method' => 'post',
322
            'action' => $routeCompanySize,
323
            'name' => 'form-company-size',
324
            'id' => 'form-company-size'
325
        ]);
326
        $form->prepare();
327
        echo $this->form()->openTag($form);
328
        ?>
329
        <div class="modal-content">
330
            <div class="modal-header">
331
                <h3 class="modal-title">LABEL_CHANGE</h3>
332
            </div>
333
            <div class="modal-body">
334
                <div class="form-group">
335
                    <?php
336
                    $element = $form->get('company_size_id');
337
                    $element->setAttributes(['class' => 'form-control']);
338
                    $element->setOptions(['label' => 'LABEL_COMPANY_SIZE']);
339
                    echo $this->formLabel($element);
340
                    echo $this->formSelect($element);
341
                    ?>
342
                </div>
343
            </div>
344
            <div class="modal-footer">
345
                <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>
347
            </div>
348
            <?php echo $this->form()->closeTag($form); ?>
349
        </div>
350
    </div>
6060 stevensc 351
</div>