Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$routeButtons = $this->url('company/view', ['id' => $company_uuid]);
3
 
4
$this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.min.js'));
5
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
6
 
7
$this->inlineScript()->captureStart();
8
echo <<<JS
9
jQuery( document ).ready(function( $ ) {
10
     $.fn.reloadButtons = function() {
11
 
12
        NProgress.start();
13
        $.ajax({
14
            'dataType'  : 'json',
15
            'accept'    : 'application/json',
16
            'method'    : 'get',
17
            'url'       :  '$routeButtons',
18
        }).done(function(response) {
19
            if(response['success']) {
20
                $('#total-followers').html(response['data']['total_followers']);
21
 
22
 
23
                $( '#div-user-buttons' ).html(
24
                    $( '#userButtonsTemplate' ).render( {
25
                        'link_request' : response['data']['link_request'],
26
                        'link_accept' : response['data']['link_accept'],
27
                        'link_cancel' : response['data']['link_cancel'],
28
                        'link_follow' : response['data']['link_follow'],
29
                        'link_unfollow' : response['data']['link_unfollow'],
30
                        'link_leave' : response['data']['link_leave'],
31
                        'link_reject' : response['data']['link_reject'],
32
                        'link_contact' : response['data']['link_contact'],
33
                    } )
34
                );
35
            } else {
36
                $.fn.showError(response['data']);
37
            }
38
        }).fail(function( jqXHR, textStatus, errorThrown) {
39
            $.fn.showError(textStatus);
40
        }).always(function() {
41
            NProgress.done();
42
        });
43
    }
44
 
45
    $('body').on('click', 'a.btn-remove-follower', function(e) {
46
        e.preventDefault();
47
 
48
        var action = $(this).data('link');
49
        NProgress.start();
50
        $.ajax({
51
            'dataType'  : 'json',
52
            'accept'    : 'application/json',
53
            'method'    : 'post',
54
            'data'      : {
55
                'flash' : true
56
            },
57
            'url'       : action,
58
        }).done(function(response) {
59
            if(response['success']) {
60
                if (jQuery.type(response['data']) == 'string') {
61
                    $.fn.showSuccess(response['data']);
62
                    $.fn.reloadButtons();
63
                } else {
64
                    if(response['data']['reload']) {
65
                        window.location.reload(true);
66
                    }
67
                }
68
            } else {
69
                $.fn.showError(response['data']);
70
            }
71
        }).fail(function( jqXHR, textStatus, errorThrown) {
72
            $.fn.showError(textStatus);
73
        }).always(function() {
74
            NProgress.done();
75
        });
76
        return false;
77
    });
78
 
79
    $('body').on('click', 'a.btn-add-follower', function(e) {
80
        e.preventDefault();
81
 
82
        var action = $(this).data('link');
83
        NProgress.start();
84
        $.ajax({
85
            'dataType'  : 'json',
86
            'accept'    : 'application/json',
87
            'method'    : 'post',
88
            'data'      : {
89
                'flash' : true
90
            },
91
            'url'       : action,
92
        }).done(function(response) {
93
            if(response['success']) {
94
               window.location.reload(true);
95
            } else {
96
                $.fn.showError(response['data']);
97
            }
98
        }).fail(function( jqXHR, textStatus, errorThrown) {
99
            $.fn.showError(textStatus);
100
        }).always(function() {
101
            NProgress.done();
102
        });
103
        return false;
104
    });
105
 
106
    $('body').on('click', 'a.btn-request', function(e) {
107
        e.preventDefault();
108
 
109
        var action = $(this).data('link');
110
        NProgress.start();
111
        $.ajax({
112
            'dataType'  : 'json',
113
            'accept'    : 'application/json',
114
            'method'    : 'post',
115
            'data'      : {
116
                'flash' : false
117
            },
118
            'url'       : action,
119
        }).done(function(response) {
120
            if(response['success']) {
121
                $.fn.showSuccess(response['data']);
122
                $.fn.reloadButtons();
123
            } else {
124
                $.fn.showError(response['data']);
125
            }
126
        }).fail(function( jqXHR, textStatus, errorThrown) {
127
            $.fn.showError(textStatus);
128
        }).always(function() {
129
            NProgress.done();
130
        });
131
    });
132
 
133
    $('body').on('click', 'a.btn-accept', function(e) {
134
        e.preventDefault();
135
 
136
        var action = $(this).data('link');
137
        NProgress.start();
138
        $.ajax({
139
            'dataType'  : 'json',
140
            'accept'    : 'application/json',
141
            'method'    : 'post',
142
            'data'      : {
143
                'flash' : true
144
            },
145
            'url'       : action,
146
        }).done(function(response) {
147
            if(response['success']) {
148
                window.location.reload(true);
149
            } else {
150
                $.fn.showError(response['data']);
151
            }
152
        }).fail(function( jqXHR, textStatus, errorThrown) {
153
            $.fn.showError(textStatus);
154
        }).always(function() {
155
            NProgress.done();
156
        });
157
    });
158
 
159
 
160
 
161
    $('body').on('click', 'a.btn-cancel', function(e) {
162
        e.preventDefault();
163
 
164
        var action = $(this).data('link');
165
        NProgress.start();
166
        $.ajax({
167
            'dataType'  : 'json',
168
            'accept'    : 'application/json',
169
            'method'    : 'post',
170
            'data'      : {
171
                'flash' : false
172
            },
173
            'url'       : action,
174
        }).done(function(response) {
175
            if(response['success']) {
176
                 $.fn.showSuccess(response['data']);
177
                 $.fn.reloadButtons();
178
            } else {
179
                $.fn.showError(response['data']);
180
            }
181
        }).fail(function( jqXHR, textStatus, errorThrown) {
182
            $.fn.showError(textStatus);
183
        }).always(function() {
184
            NProgress.done();
185
        });
186
    });
187
 
188
    $('body').on('click', 'a.btn-reject', function(e) {
189
        e.preventDefault();
190
 
191
        var action = $(this).data('link');
192
        NProgress.start();
193
        $.ajax({
194
            'dataType'  : 'json',
195
            'accept'    : 'application/json',
196
            'method'    : 'post',
197
            'data'      : {
198
                'flash' : false
199
            },
200
            'url'       : action,
201
        }).done(function(response) {
202
            if(response['success']) {
203
                $.fn.showSuccess(response['data']);
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
    });
213
 
214
 
215
    $.fn.reloadButtons();
216
 
217
});
218
JS;
219
$this->inlineScript()->captureEnd();
220
 
221
?>
222
<input type="text" name="test" id="test" style="display: none">
223
 
224
<section class="cover-sec">
225
	<img
226
		id="user-cover-img"
227
		src="<?php echo $this->url('storage', ['type' => 'company-cover', 'code' => $company_uuid, 'filename' => $cover]) ?>"
228
		alt="">
229
</section>
230
<main>
231
	<div class="main-section">
232
		<div class="container">
233
 
234
			<div class="main-section-data">
235
				<div class="row">
236
					<div class="col-lg-3">
237
						<div class="main-left-sidebar">
238
							<div class="user_profile">
239
								<div class="user-pro-img">
240
									<img id="company-img"
241
										src="<?php echo $this->url('storage', ['type' => 'company', 'code' => $company_uuid, 'filename' => $image]) ?>"
242
										alt="">
243
								</div>
244
								<!--user-pro-img end-->
245
								<div class="user_pro_status">
246
									<ul class="flw-status">
247
										<li><span>LABEL_FOLLOWERS</span> <b id="total-followers"><?php echo  $total_followers ?></b>
248
										</li>
249
									</ul>
250
								</div>
251
								<!--user_pro_status end-->
252
								<ul id="social-networks" class="social_links">
253
								<?php
254
								    if($facebook) :
255
                                        $l = strlen($facebook);
256
                                        if ($l > 32) {
257
                                            $s = substr($facebook, 0, 32) . '...';
258
                                        } else {
259
                                            $s = $facebook;
260
                                        }
261
                                    ?>
262
									<li>
263
										<a href="<?php echo $facebook ?>" target="_blank" title="">
264
											<i class="fa fa-facebook-square"></i> <?php echo $s?>
265
										</a>
266
									</li>
267
									<?php endif; ?>
268
    								<?php
269
    								if($twitter) :
270
                                    $l = strlen($twitter);
271
                                    if ($l > 32) {
272
                                        $s = substr($twitter, 0, 32) . '...';
273
                                    } else {
274
                                        $s = $twitter;
275
                                    }
276
                                    ?>
277
    								<li>
278
    									<a href="<?php echo $twitter ?>" title="" target="_blank">
279
    										<i class="fa fa-twitter"></i> <?php echo $s?>
280
    									</a>
281
    								</li>
282
    								<?php endif?>
283
    								<?php
284
    								    if($instagram) :
285
                                        $l = strlen($instagram);
286
                                        if ($l > 32) {
287
                                            $s = substr($instagram, 0, 32) . '...';
288
                                        } else {
289
                                            $s = $instagram;
290
                                        }
291
                                    ?>
292
									<li>
293
										<a href="<?php echo $instagram ?>" target="_blank" title="">
294
											<i class="fa fa-instagram"></i> <?php echo $s?>
295
										</a>
296
									</li>
297
									<?php endif; ?>
298
 
299
							</ul>
300
							</div>
301
							<!--user_profile end-->
302
							<?php echo $this->companyFollowerHelper($company_id); ?>
303
						</div>
304
						<!--main-left-sidebar end-->
305
					</div>
306
					<div class="col-lg-6">
307
						<div class="main-ws-sec">
308
							<div class="user-tab-sec rewivew">
309
								<h3><?php echo $company_name ?></h3>
310
							</div>
311
 
312
							<!--user-tab-sec end-->
313
							<?php if($overview) : ?>
314
							<div class="user-profile-extended-ov">
315
								<h3>
316
									LABEL_OVERVIEW</a>
317
								</h3>
318
								<span><?php echo $overview ?></span>
319
 
320
							</div>
321
							<?php endif; ?>
322
							<?php
323
							$max = count($locations);
324
							if($max) :
325
							?>
326
							<div class="user-profile-extended-ov st2">
327
								<h3>
328
									LABEL_LOCATIONS
329
								</h3>
330
								<span>
331
								<?php
332
 
333
									for($i = 0;  $i < $max; $i++) :
334
									$location = $locations[$i];
335
 
336
									?>
337
    								<p>
338
    									<?php echo $location['formatted_address']   ?><?php echo $location['is_main'] == 'y' ? ' (LABEL_MAIN_LOCATION) ' : ''?>
339
    								</p>
340
    								<?php if($i < ($max - 1)) : ?>
341
    								<hr/>
342
    								<?php endif; ?>
343
    								<?php endfor; ?>
344
								</span>
345
							</div>
346
							<?php endif; ?>
347
							<!--user-profile-ov end-->
348
							<?php if($industry) : ?>
349
							<div class="user-profile-ov">
350
								<h3>
351
									LABEL_INDUSTRY
352
								</h3>
353
             					<span><?php echo $industry ?></span>
354
        					</div>
355
        					<?php endif; ?>
356
							<!--user-profile-ov end-->
357
							<!--user-profile-ov end-->
358
							<?php if( $company_size)  : ?>
359
							<div class="user-profile-ov">
360
								<h3>
361
									LABEL_COMPANY_SIZE
362
								</h3>
363
             					<span><?php echo $company_size?></span>
364
        					</div>
365
        					<?php endif;?>
366
							<!--user-profile-ov end-->
367
							<!--user-profile-ov end-->
368
							<?php if($foundation_year) : ?>
369
							<div class="user-profile-ov">
370
								<h3>
371
									LABEL_FOUNDATION_YEAR
372
								</h3>
373
             					<span><?php echo $foundation_year ?></span>
374
        					</div>
375
        					<?php endif; ?>
376
							<!--user-profile-ov end-->
377
							<!--user-profile-ov end-->
378
							<?php if($website ) : ?>
379
							<div class="user-profile-ov">
380
								<h3>
381
									LABEL_WEBSITE
382
								</h3>
383
             					<span><?php echo $website ?></span>
384
        					</div>
385
        					<?php endif;?>
386
							<!--user-profile-ov end-->
387
						</div>
388
						<!--main-ws-sec end-->
389
					</div>
390
					<div class="col-lg-3">
391
						<div class="right-sidebar">
392
							<div class="message-btn" id="div-user-buttons">
393
 
394
							</div>
395
 
396
							<?php echo $this->companySuggestionHelper($company_id)?>
397
 
398
 
399
                            </div>
400
						</div>
401
						<!--right-sidebar end-->
402
					</div>
403
				</div>
404
			</div>
405
			<!-- main-section-data end-->
406
		</div>
407
	</div>
408
</main>
409
 
410
 
411
 
412
<script id="userButtonsTemplate" type="text/x-jsrender">
413
    {{if link_unfollow}}
414
    <a href="#" data-link="{{>link_unfollow}}" class="btn-remove-follower"><i class="fa fa-user-times"></i> LABEL_UNFOLLOW </a>
415
    {{/if}}
416
    {{if link_follow}}
417
    <a href="#" data-link="{{>link_follow}}" class="btn-add-follower"><i class="fa fa-plus"></i> LABEL_FOLLOW </a>
418
	{{/if}}
419
    {{if link_request}}
420
    <a href="#" data-link="{{>link_request}}" class="btn-request"><i class="fa  fa-user-plus"></i> LABEL_COMPANY_REQUEST </a>
421
    {{/if}}
422
    {{if link_accept}}
423
    <a href="#" data-link="{{>link_accept}}"  class="btn-accept"><i class="fa fa-check"></i> LABEL_ACCEPT </a>
424
	{{/if}}
425
    {{if link_cancel}}
426
    <a href="#"  data-link="{{>link_cancel}}"  title="" class="btn-cancel"><i class="fa fa-user-times " ></i> LABEL_CANCEL </a>
427
	{{/if}}
428
    {{if link_reject}}
429
    <a href="#"  data-link="{{>link_reject}}"  title="" class="btn-reject"><i class="fa fa-user-times " ></i> LABEL_REJECT </a>
430
	{{/if}}
431
    {{if link_leave}}
432
    <a href="#"  data-link="{{>link_leave}}"  title="" class="btn-leave"><i class="fa fa-user-times " ></i> LABEL_COMPANY_LEAVE </a>
433
	{{/if}}
434
    {{if link_contact}}
435
    <a href="#" data-link="{{>link_contact}}" title="" class="btn-send-message"><i class="fa fa-envelope " ></i> Mensaje </a>
436
	{{/if}}
437
</script>