Merge branch 'master' of github.com:akaunting/akaunting
This commit is contained in:
commit
2794ddc257
@ -329,6 +329,27 @@ class Item extends Controller
|
||||
return redirect()->route('apps.app.show', $alias)->send();
|
||||
}
|
||||
|
||||
public function releases($alias, Request $request)
|
||||
{
|
||||
$data = [
|
||||
'query' => [
|
||||
'page' => $request->get('page', 1),
|
||||
]
|
||||
];
|
||||
|
||||
$releases = $this->getModuleReleases($alias, $data);
|
||||
|
||||
$html = view('partials.modules.releases', compact('releases'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'error' => false,
|
||||
'data' => $releases,
|
||||
'message' => null,
|
||||
'html' => $html,
|
||||
]);
|
||||
}
|
||||
|
||||
public function reviews($alias, Request $request)
|
||||
{
|
||||
$data = [
|
||||
|
@ -72,6 +72,23 @@ trait Modules
|
||||
return $documentation;
|
||||
}
|
||||
|
||||
public function getModuleReleases($alias, $data = [])
|
||||
{
|
||||
$key = 'apps.' . $alias . '.releases.' . $this->getDataKeyOfModules($data);
|
||||
|
||||
$releases = Cache::get($key);
|
||||
|
||||
if (!empty($releases)) {
|
||||
return $releases;
|
||||
}
|
||||
|
||||
$releases = static::getResponseData('GET', 'apps/' . $alias . '/releases', $data);
|
||||
|
||||
Cache::put($key, $releases, Date::now()->addHour());
|
||||
|
||||
return $releases;
|
||||
}
|
||||
|
||||
public function getModuleReviews($alias, $data = [])
|
||||
{
|
||||
$key = 'apps.' . $alias . '.reviews.' . $this->getDataKeyOfModules($data);
|
||||
|
@ -46,7 +46,17 @@ return [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'read' => [
|
||||
'host' => [
|
||||
env('DB_HOST_READ', env('DB_HOST', '127.0.0.1')),
|
||||
],
|
||||
],
|
||||
'write' => [
|
||||
'host' => [
|
||||
env('DB_HOST_WRITE', env('DB_HOST', '127.0.0.1')),
|
||||
],
|
||||
],
|
||||
'sticky' => env('DB_STICKY', true),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
|
@ -64,6 +64,7 @@ import AkauntingRecurring from './AkauntingRecurring';
|
||||
|
||||
import Form from './../plugins/form';
|
||||
import { Alert, ColorPicker } from 'element-ui';
|
||||
import Global from './../mixins/global';
|
||||
|
||||
export default {
|
||||
name: 'akaunting-modal-add-new',
|
||||
@ -150,7 +151,7 @@ export default {
|
||||
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
||||
resolve({
|
||||
template : '<div id="modal-add-new-form-' + form_prefix + '">' + this.message + '</div>',
|
||||
|
||||
mixins: [Global],
|
||||
components: {
|
||||
AkauntingRadioGroup,
|
||||
AkauntingSelect,
|
||||
|
@ -318,11 +318,16 @@ export default {
|
||||
this.selected = this.value;
|
||||
|
||||
if (this.model.length) {
|
||||
try {
|
||||
if (eval(this.model) !== undefined) {
|
||||
this.selected = eval(this.model);
|
||||
} else {
|
||||
this.selected = this.model;
|
||||
}
|
||||
} catch (e) {
|
||||
this.selected = this.model;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.multiple && !this.selected.length) {
|
||||
|
@ -430,11 +430,16 @@ export default {
|
||||
this.selected = this.value;
|
||||
|
||||
if (this.model.length) {
|
||||
try {
|
||||
if (eval(this.model) !== undefined) {
|
||||
this.selected = eval(this.model);
|
||||
} else {
|
||||
this.selected = this.model;
|
||||
}
|
||||
} catch (e) {
|
||||
this.selected = this.model;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.multiple && !this.selected.length) {
|
||||
|
27
resources/assets/js/views/modules/item.js
vendored
27
resources/assets/js/views/modules/item.js
vendored
@ -32,11 +32,20 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.onReleases(1);
|
||||
this.onReviews(1);
|
||||
},
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
releases: {
|
||||
status: false,
|
||||
html: '',
|
||||
pagination: {
|
||||
current_page: 1,
|
||||
last_page: 1
|
||||
}
|
||||
},
|
||||
reviews: {
|
||||
status: false,
|
||||
html: '',
|
||||
@ -77,6 +86,24 @@ const app = new Vue({
|
||||
location = path;
|
||||
},
|
||||
|
||||
async onReleases(page) {
|
||||
let releases_promise = Promise.resolve(window.axios.post(url + '/apps/' + app_slug + '/releases', {
|
||||
page: page
|
||||
}));
|
||||
|
||||
releases_promise.then(response => {
|
||||
if (response.data.success) {
|
||||
this.releases.status= true;
|
||||
this.releases.html = response.data.html;
|
||||
|
||||
this.releases.pagination.current_page = page;
|
||||
this.releases.pagination.last_page = response.data.data.last_page;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
});
|
||||
},
|
||||
|
||||
async onReviews(page) {
|
||||
let reviews_promise = Promise.resolve(window.axios.post(url + '/apps/' + app_slug + '/reviews', {
|
||||
page: page
|
||||
|
@ -230,9 +230,9 @@
|
||||
|
||||
<tr v-for="(row_tax, row_tax_index) in row.tax_ids"
|
||||
:index="row_tax_index">
|
||||
<td colspan="2" class="pl-0 pb-0 border-0" :class="{'pb-2' : !row.add_tax}">
|
||||
<td class="pl-0 pb-0 border-0" :class="{'pb-2' : !row.add_tax}" style="width: 42%;">
|
||||
<div>
|
||||
<div style="float: left; margin-top: 15px; right: 43%; position: absolute;">
|
||||
<div style="float: left; margin-top: 15px; margin-right:2px">
|
||||
{{ trans_choice('general.taxes', 1) }}
|
||||
</div>
|
||||
|
||||
@ -258,13 +258,13 @@
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td :class="{'pb-2' : !row.add_tax}" class="border-0 pb-0 text-right long-texts">
|
||||
<td :class="{'pb-2' : !row.add_tax}" class="border-0 pb-0 text-right long-texts" style="width: 39%;">
|
||||
<div>
|
||||
{{ Form::moneyGroup('tax', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row_tax.price', 'data-item' => 'total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="pb-3 pl-2 align-bottom border-0" :class="{'pb-2' : !row.add_tax}" style="max-width: 40px;" >
|
||||
<td class="pb-3 pl-2 align-bottom border-0" :class="{'pb-2' : !row.add_tax}" style="width:19%;" >
|
||||
<button type="button" @click="onDeleteTax(index, row_tax_index)" class="btn btn-link btn-delete p-0">
|
||||
<i class="far fa-trash-alt"></i>
|
||||
</button>
|
||||
@ -272,9 +272,9 @@
|
||||
</tr>
|
||||
|
||||
<tr v-if="row.add_tax">
|
||||
<td colspan="2" class="pl-0 border-0">
|
||||
<td class="pl-0 border-0" style="width:42%;">
|
||||
<div>
|
||||
<div style="float: left; margin-top: 15px; right: 43%; position: absolute;">
|
||||
<div style="float: left; margin-top: 15px; margin-right:2px;">
|
||||
{{ trans_choice('general.taxes', 1) }}
|
||||
</div>
|
||||
|
||||
@ -322,13 +322,13 @@
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="border-0 text-right long-texts align-middle">
|
||||
<td class="border-0 text-right long-texts align-middle;" style="width:39%;">
|
||||
<div>
|
||||
__
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="pb-3 pl-2 align-bottom border-0" style="max-width: 40px;" >
|
||||
<td class="pb-3 pl-2 align-bottom border-0" style="width:19%;" >
|
||||
@if (!$hideDiscount && in_array(setting('localisation.discount_location'), ['item', 'both']))
|
||||
<button type="button" @click="onDeleteTax(index, 999)" class="btn btn-link btn-delete p-0">
|
||||
<i class="far fa-trash-alt"></i>
|
||||
|
@ -104,7 +104,70 @@
|
||||
|
||||
@if ($module->changelog)
|
||||
<div class="tab-pane fade" id="changelog">
|
||||
{!! $module->changelog !!}
|
||||
@php
|
||||
$releases = $module->app_releases;
|
||||
@endphp
|
||||
|
||||
<div id="releases" class="clearfix" v-if="releases.status" v-html="releases.html"></div>
|
||||
|
||||
<div id="releases" class="clearfix" v-else>
|
||||
@include('partials.modules.releases')
|
||||
</div>
|
||||
|
||||
@php
|
||||
$release_first_item = count($releases->data) > 0 ? ($releases->current_page - 1) * $releases->per_page + 1 : null;
|
||||
$release_last_item = count($releases->data) > 0 ? $release_first_item + count($releases->data) - 1 : null;
|
||||
@endphp
|
||||
|
||||
@if (!empty($release_first_item))
|
||||
@stack('pagination_start')
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-6">
|
||||
<span class="table-text d-lg-block">
|
||||
{{ trans('pagination.showing', ['first' => $release_first_item, 'last' => $release_last_item, 'total' => $releases->total, 'type' => strtolower(trans('modules.tab.changelog'))]) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<ul class="pagination float-right">
|
||||
{{-- Previous Page Link --}}
|
||||
<li class="page-item disabled" v-if="releases.pagination.current_page == 1">
|
||||
<span class="page-link">«</span>
|
||||
</li>
|
||||
<li class="page-item" v-else>
|
||||
<button type="button" class="page-link" @click="onReleases(releases.pagination.current_page - 1)" rel="prev">«</button>
|
||||
</li>
|
||||
|
||||
{{-- Pagination Elements --}}
|
||||
@for ($page = 1; $page <= $releases->last_page; $page++)
|
||||
<li class="page-item" :class="[{'active': releases.pagination.current_page == {{ $page }}}]" v-if="releases.pagination.current_page == {{ $page }}">
|
||||
<span class="page-link">{{ $page }}</span>
|
||||
</li>
|
||||
<li class="page-item" v-else>
|
||||
<button type="button" class="page-link" @click="onReleases({{ $page }})" data-page="{{ $page }}">{{ $page }}</button>
|
||||
</li>
|
||||
@endfor
|
||||
|
||||
{{-- Next Page Link --}}
|
||||
<li class="page-item" v-if="releases.pagination.last_page != releases.pagination.current_page">
|
||||
<button type="button" class="page-link" @click="onReleases(releases.pagination.current_page + 1)" rel="next">»</button>
|
||||
</li>
|
||||
<li class="page-item disabled" v-else>
|
||||
<span class="page-link">»</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stack('pagination_end')
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<small>{{ trans('general.no_records') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
9
resources/views/partials/modules/releases.blade.php
Normal file
9
resources/views/partials/modules/releases.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
<div id="releases-items">
|
||||
@if (!empty($releases))
|
||||
@foreach($releases->data as $release)
|
||||
<p>{{ $release->version }} - @date($release->released_at)</p>
|
||||
|
||||
{!! $release->changelog !!}
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user