337 lines
15 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
@extends('layouts.modules')
@section('title', trans_choice('general.modules', 2))
2018-04-25 11:31:49 +03:00
@section('new_button')
<span class="new-button"><a href="{{ url('apps/token/create') }}" class="btn btn-success btn-sm"><span class="fa fa-key"></span> &nbsp;{{ trans('modules.api_token') }}</a></span>
2018-05-29 14:06:39 +03:00
<span class="new-button"><a href="{{ url('apps/my') }}" class="btn btn-default btn-sm"><span class="fa fa-user"></span> &nbsp;{{ trans('modules.my_apps') }}</a></span>
2018-04-25 11:31:49 +03:00
@endsection
2017-09-14 22:21:00 +03:00
@section('content')
@include('partials.modules.bar')
2017-12-06 15:57:38 +03:00
<div class="row">
<div class="col-md-12">
<div class="col-md-8 no-padding-left">
<div class="content-header no-padding-left">
<h3>{{ $module->name }}</h3>
<div class="pull-right rating">
@for($i = 1; $i <= $module->vote; $i++)
<i class="fa fa-star fa-lg"></i>
@endfor
@for($i = $module->vote; $i < 5; $i++)
<i class="fa fa-star-o fa-lg"></i>
@endfor
</div>
2017-12-06 15:57:38 +03:00
</div>
2017-09-14 22:21:00 +03:00
2017-12-06 15:57:38 +03:00
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#description" data-toggle="tab" aria-expanded="true">{{ trans('general.description') }}</a></li>
@if ($module->installation)
<li class=""><a href="#installation" data-toggle="tab" aria-expanded="false">{{ trans('modules.tab.installation') }}</a></li>
@endif
@if ($module->faq)
<li class=""><a href="#faq" data-toggle="tab" aria-expanded="false">{{ trans('modules.tab.faq') }}</a></li>
@endif
@if ($module->changelog)
<li class=""><a href="#changelog" data-toggle="tab" aria-expanded="false">{{ trans('modules.tab.changelog') }}</a></li>
@endif
<li><a href="#review" data-toggle="tab" aria-expanded="false">{{ trans('modules.tab.reviews') }} @if ($module->total_review) ({{ $module->total_review }}) @endif</a></li>
2017-12-06 15:57:38 +03:00
</ul>
<div class="tab-content">
<div class="tab-pane active" id="description">
{!! $module->description !!}
</div>
@if ($module->installation)
<div class="tab-pane" id="installation">
{!! $module->installation !!}
</div>
@endif
@if ($module->faq)
<div class="tab-pane" id="faq">
{!! $module->faq !!}
</div>
@endif
@if ($module->changelog)
<div class="tab-pane" id="changelog">
{!! $module->changelog !!}
</div>
@endif
<div class="tab-pane" id="review">
<div id="reviews" class="clearfix">
2018-09-20 18:35:24 +03:00
@if(!$module->reviews)
{{ trans('modules.reviews.na') }}
@endif
</div>
<hr>
@if (!empty($module->review_action))
<a href="{{ $module->review_action }}" class="btn btn-success" target="_blank">
{{ trans('modules.reviews.button.add') }}
</a>
@endif
</div>
2017-09-14 22:21:00 +03:00
</div>
</div>
</div>
2017-12-06 15:57:38 +03:00
<div class="col-md-4">
<div class="content-header no-padding-left">
<h3>{{ trans_choice('general.actions', 1) }}</h3>
2017-09-14 22:21:00 +03:00
</div>
2017-12-06 15:57:38 +03:00
<div class="box box-success">
<div class="box-body">
2018-04-26 13:21:43 +03:00
<div class="text-center">
<div style="margin: 10px; font-size: 24px;">
@if ($module->price == '0.0000')
{{ trans('modules.free') }}
@else
2018-05-12 13:44:07 +03:00
@if (isset($module->special_price))
<del>{{ $module->price }}</del>
{{ $module->special_price }}
@else
{{ $module->price }}
@endif
2018-04-26 13:21:43 +03:00
@endif
</div>
</div>
2017-12-06 15:57:38 +03:00
</div>
<!-- /.box-body -->
<div class="box-footer">
@if ($installed)
2017-12-27 17:06:14 +03:00
@permission('delete-modules-item')
2017-12-06 15:57:38 +03:00
<a href="{{ url('apps/' . $module->slug . '/uninstall') }}" class="btn btn-block btn-danger">{{ trans('modules.button.uninstall') }}</a>
2017-12-27 17:06:14 +03:00
@endpermission
@permission('update-modules-item')
2017-12-06 15:57:38 +03:00
@if ($enable)
<a href="{{ url('apps/' . $module->slug . '/disable') }}" class="btn btn-block btn-warning">{{ trans('modules.button.disable') }}</a>
@else
<a href="{{ url('apps/' . $module->slug . '/enable') }}" class="btn btn-block btn-success">{{ trans('modules.button.enable') }}</a>
@endif
2017-12-27 17:06:14 +03:00
@endpermission
2017-11-01 22:15:25 +03:00
@else
2017-12-27 17:06:14 +03:00
@permission('create-modules-item')
2017-12-06 15:57:38 +03:00
@if ($module->install)
<a href="{{ $module->action_url }}" class="btn btn-success btn-block" id="install-module">
{{ trans('modules.install') }}
</a>
@else
<a href="{{ $module->action_url }}" class="btn btn-success btn-block" target="_blank">
{{ trans('modules.buy_now') }}
</a>
@endif
2017-12-27 17:06:14 +03:00
@endpermission
2017-11-01 22:15:25 +03:00
@endif
2017-12-06 15:57:38 +03:00
</div>
<!-- /.box-footer -->
2017-09-14 22:21:00 +03:00
</div>
2017-12-06 15:57:38 +03:00
<!-- /.box -->
2017-09-14 22:21:00 +03:00
2017-12-06 15:57:38 +03:00
<div class="content-header no-padding-left">
2017-12-07 00:49:39 +03:00
<h3>{{ trans('modules.about') }}</h3>
2017-12-06 15:57:38 +03:00
</div>
2017-09-14 22:21:00 +03:00
2017-12-06 15:57:38 +03:00
<div class="box box-success">
<div class="box-body">
<table class="table table-striped">
<tbody>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans_choice('general.vendors', 1) }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right"><a href="{{ url('apps/vendor/' . $module->vendor->id) }}">{{ $module->vendor_name }}</a></td>
</tr>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans('footer.version') }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right">{{ $module->version }}</td>
</tr>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans('modules.added') }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right">{{ Date::parse($module->created_at)->format($date_format) }}</td>
</tr>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans('modules.updated') }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right">{{ Date::parse($module->updated_at)->diffForHumans() }}</td>
</tr>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans('modules.compatibility') }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right">{{ $module->compatibility }}</td>
</tr>
<tr>
2017-12-07 00:49:39 +03:00
<th>{{ trans_choice('general.categories', 1) }}</th>
2017-12-06 15:57:38 +03:00
<td class="text-right"><a href="{{ url('apps/categories/' . $module->category->slug) }}">{{ $module->category->name }}</a></td>
</tr>
</tbody>
</table>
</div>
<!-- /.box-body -->
2017-09-14 22:21:00 +03:00
</div>
2017-12-06 15:57:38 +03:00
<!-- /.box -->
2017-09-14 22:21:00 +03:00
</div>
</div>
</div>
@endsection
2017-12-07 00:49:39 +03:00
@push('css')
<style type="text/css">
.nav-tabs-custom img {
display: block;
max-width: 100%;
height: auto;
}
</style>
@endpush
2017-11-13 21:55:15 +03:00
@push('scripts')
2017-09-14 22:21:00 +03:00
<script type="text/javascript">
var step = new Array();
var total = 0;
var path = '';
$(document).ready(function() {
2018-09-20 18:35:24 +03:00
@if($module->reviews)
getReviews('', '1');
@endif
2017-09-14 22:21:00 +03:00
$('#install-module').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
path = $(this).attr('href');
startInstallation();
$.ajax({
2017-11-01 22:15:25 +03:00
url: '{{ url("apps/steps") }}',
2017-09-14 22:21:00 +03:00
type: 'post',
dataType: 'json',
data: {name: '{{ $module->name }}', version: '{{ $module->version }}'},
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
success: function(json) {
if (json['errorr']) {
$('#progress-bar').addClass('progress-bar-danger');
$('#progress-text').html('<div class="text-danger">' + json['error'] + '</div>');
}
if (json['step']) {
step = json['step'];
total = step.length;
next();
}
}
});
});
});
2018-09-20 18:35:24 +03:00
$(document).on('click', '#reviews .pagination li a', function (e) {
e.preventDefault();
e.stopPropagation();
path = $(this).attr('href');
page = $(this).data('page');
getReviews(path, page);
});
2017-09-14 22:21:00 +03:00
function next() {
data = step.shift();
if (data) {
$('#progress-bar').css('width', (100 - (step.length / total) * 100) + '%');
$('#progress-text').html('<span class="text-info">' + data['text'] + '</span>');
setTimeout(function() {
$.ajax({
url: data.url,
type: 'post',
dataType: 'json',
data: {path: path, version: '{{ $module->version }}'},
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
success: function(json) {
if (json['errors']) {
$('#progress-bar').addClass('progress-bar-danger');
$('#progress-text').html('<div class="text-danger">' + json['errors'] + '</div>');
}
if (json['success']) {
$('#progress-bar').removeClass('progress-bar-danger');
$('#progress-bar').addClass('progress-bar-success');
}
if (json['data']['path']) {
path = json['data']['path'];
}
if (!json['errors'] && !json['installed']) {
next();
}
if (json['installed']) {
window.location = json['installed'];
2017-09-14 22:21:00 +03:00
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}, 800);
}
}
function startInstallation() {
$('#modal-installation').remove();
modal = '<div class="modal fade" id="modal-installation" style="display: none;">';
modal += ' <div class="modal-dialog">';
modal += ' <div class="modal-content">';
modal += ' <div class="modal-header">';
modal += ' <h4 class="modal-title">{{ trans('modules.installation.header') }}</h4>';
modal += ' </div>';
modal += ' <div class="modal-body">';
modal += ' <p></p>';
modal += ' <p>';
modal += ' <div class="progress">';
modal += ' <div id="progress-bar" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">';
modal += ' <span class="sr-only">{{ trans('modules.installation.start', ['module' => $module->name]) }}</span>';
modal += ' </div>';
modal += ' </div>';
modal += ' <div id="progress-text"></div>';
modal += ' </p>';
modal += ' </div>';
modal += ' </div>';
modal += ' </div>';
modal += '</div>';
$('body').append(modal);
$('#modal-installation').modal('show');
}
2018-09-20 18:35:24 +03:00
function getReviews(path, page) {
$.ajax({
url: '{{ url("apps/" . $module->slug . "/reviews") }}',
type: 'post',
dataType: 'json',
data: {path: path, page: page},
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
beforeSend: function() {
$('#reviews').append('<div id="loading" class="text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>');
},
complete : function() {
$('#loading').remove();
},
success: function(json) {
if (json['success']) {
$('#reviews #review-items').remove();
$('#reviews').append(json['html']);
}
}
});
}
2017-09-14 22:21:00 +03:00
</script>
2017-11-13 21:55:15 +03:00
@endpush