AutorÃa | Ultima modificación | Ver Log |
<?php
$routeButtons = $this->url('company/view', ['id' => $company_uuid]);
$this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.min.js'));
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
$this->inlineScript()->captureStart();
echo <<<JS
jQuery( document ).ready(function( $ ) {
$.fn.reloadButtons = function() {
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'get',
'url' : '$routeButtons',
}).done(function(response) {
if(response['success']) {
$('#total-followers').html(response['data']['total_followers']);
$( '#div-user-buttons' ).html(
$( '#userButtonsTemplate' ).render( {
'link_request' : response['data']['link_request'],
'link_accept' : response['data']['link_accept'],
'link_cancel' : response['data']['link_cancel'],
'link_follow' : response['data']['link_follow'],
'link_unfollow' : response['data']['link_unfollow'],
'link_leave' : response['data']['link_leave'],
'link_reject' : response['data']['link_reject'],
'link_contact' : response['data']['link_contact'],
} )
);
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
}
$('body').on('click', 'a.btn-remove-follower', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : true
},
'url' : action,
}).done(function(response) {
if(response['success']) {
if (jQuery.type(response['data']) == 'string') {
$.fn.showSuccess(response['data']);
$.fn.reloadButtons();
} else {
if(response['data']['reload']) {
window.location.reload(true);
}
}
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
return false;
});
$('body').on('click', 'a.btn-add-follower', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : true
},
'url' : action,
}).done(function(response) {
if(response['success']) {
window.location.reload(true);
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
return false;
});
$('body').on('click', 'a.btn-request', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : false
},
'url' : action,
}).done(function(response) {
if(response['success']) {
$.fn.showSuccess(response['data']);
$.fn.reloadButtons();
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$('body').on('click', 'a.btn-accept', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : true
},
'url' : action,
}).done(function(response) {
if(response['success']) {
window.location.reload(true);
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$('body').on('click', 'a.btn-cancel', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : false
},
'url' : action,
}).done(function(response) {
if(response['success']) {
$.fn.showSuccess(response['data']);
$.fn.reloadButtons();
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$('body').on('click', 'a.btn-reject', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'data' : {
'flash' : false
},
'url' : action,
}).done(function(response) {
if(response['success']) {
$.fn.showSuccess(response['data']);
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$.fn.reloadButtons();
});
JS;
$this->inlineScript()->captureEnd();
?>
<input type="text" name="test" id="test" style="display: none">
<section class="cover-sec">
<img
id="user-cover-img"
src="<?php echo $this->url('storage', ['type' => 'company-cover', 'code' => $company_uuid, 'filename' => $cover]) ?>"
alt="">
</section>
<main>
<div class="main-section">
<div class="container">
<div class="main-section-data">
<div class="row">
<div class="col-lg-3">
<div class="main-left-sidebar">
<div class="user_profile">
<div class="user-pro-img">
<img id="company-img"
src="<?php echo $this->url('storage', ['type' => 'company', 'code' => $company_uuid, 'filename' => $image]) ?>"
alt="">
</div>
<!--user-pro-img end-->
<div class="user_pro_status">
<ul class="flw-status">
<li><span>LABEL_FOLLOWERS</span> <b id="total-followers"><?php echo $total_followers ?></b>
</li>
</ul>
</div>
<!--user_pro_status end-->
<ul id="social-networks" class="social_links">
<?php
if($facebook) :
$l = strlen($facebook);
if ($l > 32) {
$s = substr($facebook, 0, 32) . '...';
} else {
$s = $facebook;
}
?>
<li>
<a href="<?php echo $facebook ?>" target="_blank" title="">
<i class="fa fa-facebook-square"></i> <?php echo $s?>
</a>
</li>
<?php endif; ?>
<?php
if($twitter) :
$l = strlen($twitter);
if ($l > 32) {
$s = substr($twitter, 0, 32) . '...';
} else {
$s = $twitter;
}
?>
<li>
<a href="<?php echo $twitter ?>" title="" target="_blank">
<i class="fa fa-twitter"></i> <?php echo $s?>
</a>
</li>
<?php endif?>
<?php
if($instagram) :
$l = strlen($instagram);
if ($l > 32) {
$s = substr($instagram, 0, 32) . '...';
} else {
$s = $instagram;
}
?>
<li>
<a href="<?php echo $instagram ?>" target="_blank" title="">
<i class="fa fa-instagram"></i> <?php echo $s?>
</a>
</li>
<?php endif; ?>
</ul>
</div>
<!--user_profile end-->
<?php echo $this->companyFollowerHelper($company_id); ?>
</div>
<!--main-left-sidebar end-->
</div>
<div class="col-lg-6">
<div class="main-ws-sec">
<div class="user-tab-sec rewivew">
<h3><?php echo $company_name ?></h3>
</div>
<!--user-tab-sec end-->
<?php if($overview) : ?>
<div class="user-profile-extended-ov">
<h3>
LABEL_OVERVIEW</a>
</h3>
<span><?php echo $overview ?></span>
</div>
<?php endif; ?>
<?php
$max = count($locations);
if($max) :
?>
<div class="user-profile-extended-ov st2">
<h3>
LABEL_LOCATIONS
</h3>
<span>
<?php
for($i = 0; $i < $max; $i++) :
$location = $locations[$i];
?>
<p>
<?php echo $location['formatted_address'] ?><?php echo $location['is_main'] == 'y' ? ' (LABEL_MAIN_LOCATION) ' : ''?>
</p>
<?php if($i < ($max - 1)) : ?>
<hr/>
<?php endif; ?>
<?php endfor; ?>
</span>
</div>
<?php endif; ?>
<!--user-profile-ov end-->
<?php if($industry) : ?>
<div class="user-profile-ov">
<h3>
LABEL_INDUSTRY
</h3>
<span><?php echo $industry ?></span>
</div>
<?php endif; ?>
<!--user-profile-ov end-->
<!--user-profile-ov end-->
<?php if( $company_size) : ?>
<div class="user-profile-ov">
<h3>
LABEL_COMPANY_SIZE
</h3>
<span><?php echo $company_size?></span>
</div>
<?php endif;?>
<!--user-profile-ov end-->
<!--user-profile-ov end-->
<?php if($foundation_year) : ?>
<div class="user-profile-ov">
<h3>
LABEL_FOUNDATION_YEAR
</h3>
<span><?php echo $foundation_year ?></span>
</div>
<?php endif; ?>
<!--user-profile-ov end-->
<!--user-profile-ov end-->
<?php if($website ) : ?>
<div class="user-profile-ov">
<h3>
LABEL_WEBSITE
</h3>
<span><?php echo $website ?></span>
</div>
<?php endif;?>
<!--user-profile-ov end-->
</div>
<!--main-ws-sec end-->
</div>
<div class="col-lg-3">
<div class="right-sidebar">
<div class="message-btn" id="div-user-buttons">
</div>
<?php echo $this->companySuggestionHelper($company_id)?>
</div>
</div>
<!--right-sidebar end-->
</div>
</div>
</div>
<!-- main-section-data end-->
</div>
</div>
</main>
<script id="userButtonsTemplate" type="text/x-jsrender">
{{if link_unfollow}}
<a href="#" data-link="{{>link_unfollow}}" class="btn-remove-follower"><i class="fa fa-user-times"></i> LABEL_UNFOLLOW </a>
{{/if}}
{{if link_follow}}
<a href="#" data-link="{{>link_follow}}" class="btn-add-follower"><i class="fa fa-plus"></i> LABEL_FOLLOW </a>
{{/if}}
{{if link_request}}
<a href="#" data-link="{{>link_request}}" class="btn-request"><i class="fa fa-user-plus"></i> LABEL_COMPANY_REQUEST </a>
{{/if}}
{{if link_accept}}
<a href="#" data-link="{{>link_accept}}" class="btn-accept"><i class="fa fa-check"></i> LABEL_ACCEPT </a>
{{/if}}
{{if link_cancel}}
<a href="#" data-link="{{>link_cancel}}" title="" class="btn-cancel"><i class="fa fa-user-times " ></i> LABEL_CANCEL </a>
{{/if}}
{{if link_reject}}
<a href="#" data-link="{{>link_reject}}" title="" class="btn-reject"><i class="fa fa-user-times " ></i> LABEL_REJECT </a>
{{/if}}
{{if link_leave}}
<a href="#" data-link="{{>link_leave}}" title="" class="btn-leave"><i class="fa fa-user-times " ></i> LABEL_COMPANY_LEAVE </a>
{{/if}}
{{if link_contact}}
<a href="#" data-link="{{>link_contact}}" title="" class="btn-send-message"><i class="fa fa-envelope " ></i> Mensaje </a>
{{/if}}
</script>