Merge pull request #2464 from brkcvn/master
Connect transactions moved to global function
This commit is contained in:
commit
60cb7f1364
@ -480,7 +480,7 @@ class Transaction extends Model
|
||||
'permission' => 'create-banking-transactions',
|
||||
'attributes' => [
|
||||
'id' => 'index-transactions-more-actions-connect-' . $this->id,
|
||||
'@click' => 'onConnect(\'' . route('transactions.dial', $this->id) . '\')',
|
||||
'@click' => 'onConnectTransactions(\'' . route('transactions.dial', $this->id) . '\')',
|
||||
],
|
||||
];
|
||||
|
||||
|
37
resources/assets/js/mixins/global.js
vendored
37
resources/assets/js/mixins/global.js
vendored
@ -85,7 +85,12 @@ export default {
|
||||
"thousands_separator":",",
|
||||
},
|
||||
all_currencies: [],
|
||||
content_loading: true
|
||||
content_loading: true,
|
||||
connect: {
|
||||
show: false,
|
||||
currency: {},
|
||||
documents: [],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@ -656,6 +661,34 @@ export default {
|
||||
copy_badge.classList.remove('flex');
|
||||
copy_html.classList.remove('hidden');
|
||||
}, 800);
|
||||
}
|
||||
},
|
||||
|
||||
//connect transactions for account, document or etc.
|
||||
onConnectTransactions(route) {
|
||||
let dial_promise = Promise.resolve(window.axios.get(route));
|
||||
|
||||
dial_promise.then(response => {
|
||||
this.connect.show = true;
|
||||
|
||||
this.connect.transaction = JSON.parse(response.data.transaction);
|
||||
|
||||
let currency = JSON.parse(response.data.currency);
|
||||
|
||||
this.connect.currency = {
|
||||
decimal_mark: currency.decimal_mark,
|
||||
precision: currency.precision,
|
||||
symbol: currency.symbol,
|
||||
symbol_first: currency.symbol_first,
|
||||
thousands_separator: currency.thousands_separator,
|
||||
};
|
||||
|
||||
this.connect.documents = JSON.parse(response.data.documents);
|
||||
})
|
||||
.catch(error => {
|
||||
})
|
||||
.finally(function () {
|
||||
// always executed
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -29,42 +29,10 @@ const app = new Vue({
|
||||
return {
|
||||
form: new Form('transaction'),
|
||||
bulk_action: new BulkAction('transactions'),
|
||||
connect: {
|
||||
show: false,
|
||||
currency: {},
|
||||
documents: [],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onConnect(route) {
|
||||
let dial_promise = Promise.resolve(window.axios.get(route));
|
||||
|
||||
dial_promise.then(response => {
|
||||
this.connect.show = true;
|
||||
|
||||
this.connect.transaction = JSON.parse(response.data.transaction);
|
||||
|
||||
let currency = JSON.parse(response.data.currency);
|
||||
|
||||
this.connect.currency = {
|
||||
decimal_mark: currency.decimal_mark,
|
||||
precision: currency.precision,
|
||||
symbol: currency.symbol,
|
||||
symbol_first: currency.symbol_first,
|
||||
thousands_separator: currency.thousands_separator,
|
||||
};
|
||||
|
||||
this.connect.documents = JSON.parse(response.data.documents);
|
||||
})
|
||||
.catch(error => {
|
||||
})
|
||||
.finally(function () {
|
||||
// always executed
|
||||
});
|
||||
},
|
||||
|
||||
async onEmail(route) {
|
||||
let email = {
|
||||
modal: false,
|
||||
|
@ -291,11 +291,17 @@
|
||||
<x-slot name="first">
|
||||
{{ $item->contact->name }}
|
||||
</x-slot>
|
||||
<x-slot name="second">
|
||||
<x-slot name="second" class="w-20 font-normal group">
|
||||
@if ($item->document)
|
||||
<div data-tooltip-target="tooltip-information-{{ $item->document_id }}" data-tooltip-placement="left" override="class">
|
||||
<a href="{{ route($item->route_name, $item->route_id) }}" class="font-normal truncate border-b border-black border-dashed">
|
||||
{{ $item->document->document_number }}
|
||||
</a>
|
||||
|
||||
<div class="w-28 absolute h-10 -ml-12 -mt-6"></div>
|
||||
|
||||
<x-documents.index.information :document="$item->document" />
|
||||
</div>
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
||||
@ -444,6 +450,16 @@
|
||||
</x-show.content.right>
|
||||
</x-show.content>
|
||||
</x-show.container>
|
||||
|
||||
<akaunting-connect-transactions
|
||||
:show="connect.show"
|
||||
:transaction="connect.transaction"
|
||||
:currency="connect.currency"
|
||||
:documents="connect.documents"
|
||||
:translations="{{ json_encode($transactions) }}"
|
||||
modal-dialog-class="max-w-screen-lg"
|
||||
v-on:close-modal="connect.show = false"
|
||||
></akaunting-connect-transactions>
|
||||
</x-slot>
|
||||
|
||||
<x-script folder="banking" file="accounts" />
|
||||
|
@ -29,7 +29,7 @@
|
||||
type="button"
|
||||
class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap"
|
||||
title="{{ trans('general.connect') }}"
|
||||
@click="onConnect('{{ route('transactions.dial', $transaction->id) }}')">
|
||||
@click="onConnectTransactions('{{ route('transactions.dial', $transaction->id) }}')">
|
||||
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">{{ trans('general.connect') }}</span>
|
||||
</button>
|
||||
@endcan
|
||||
|
Loading…
x
Reference in New Issue
Block a user