Skip to content

Commit

Permalink
Merge pull request #9 from akaunting/dev-30
Browse files Browse the repository at this point in the history
Akaunting 3.0 compatibility
  • Loading branch information
denisdulici authored Jun 2, 2022
2 parents c649c76 + d1d5c53 commit 71b80d1
Show file tree
Hide file tree
Showing 19 changed files with 431 additions and 328 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.idea
/.history
/.vscode
/.vagrant
/node_modules
/storage/*.key
/.idea
/.history
/.vscode
/.vagrant
/node_modules
/storage/*.key
/vendor
2 changes: 1 addition & 1 deletion Http/Controllers/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Payment extends PaymentController

public $type = 'redirect';

public function show(Document $invoice, PaymentRequest $request)
public function show(Document $invoice, PaymentRequest $request, $cards = [])
{
$setting = [];

Expand Down
10 changes: 0 additions & 10 deletions Http/Controllers/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,7 @@ public function destroy(DRequest $request)
$response = $this->ajaxDispatch(new DeletePaymentMethod($request));

if ($response['success']) {
//$response['redirect'] = route('offline-payments.settings.edit');

$response['message'] = trans('messages.success.deleted', ['type' => $response['data']['name']]);

//flash($message)->success();
} else {
//$response['redirect'] = route('offline-payments.settings.edit');

$message = $response['message'];

//flash($message)->error()->important();
}

return response()->json($response);
Expand Down
31 changes: 31 additions & 0 deletions Listeners/ShowInSettingsMenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Modules\OfflinePayments\Listeners;

use App\Events\Menu\SettingsCreated as Event;
use App\Traits\Modules;
use App\Traits\Permissions;

class ShowInSettingsMenu
{
use Modules, Permissions;

/**
* Handle the event.
*
* @param Event $event
* @return void
*/
public function handle(Event $event)
{
if (!$this->moduleIsEnabled('offline-payments')) {
return;
}

$title = trans('offline-payments::general.name');

if ($this->canAccessMenuItem($title, 'read-offline-payments-settings')) {
$event->menu->route('offline-payments.settings.edit', $title, [], 100, ['icon' => 'credit_card', 'search_keywords' => trans('offline-payments::general.description')]);
}
}
}
24 changes: 0 additions & 24 deletions Listeners/ShowInSettingsPage.php

This file was deleted.

34 changes: 34 additions & 0 deletions Listeners/Update/Version300.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Modules\OfflinePayments\Listeners\Update;

use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished;
use Illuminate\Support\Facades\File;

class Version300 extends Listener
{
const ALIAS = 'offline-payments';

const VERSION = '3.0.0';

/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(UpdateFinished $event)
{
if ($this->skipThisUpdate($event)) {
return;
}

$this->deleteOldFiles();
}

protected function deleteOldFiles()
{
File::delete(base_path('modules/OfflinePayments/Listeners/ShowInSettingsPage.php'));
}
}
20 changes: 4 additions & 16 deletions Resources/assets/js/offline-payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,8 @@ const app = new Vue({

methods:{
onEdit(event) {
var code = event.target.dataset.code;

this.form_loading = '<span class="form-loading-bar"><span class="form-loading-spin"><i class="fa fa-spinner fa-spin"></i></span></span>';

this.form.loading = true;

axios.post(url + '/offline-payments/settings/get', {
code: code
code: event
})
.then(response => {
this.form.name = response.data.data.name;
Expand Down Expand Up @@ -87,22 +81,16 @@ const app = new Vue({
methods: {
// Delete action post
async onDelete() {
let promise = Promise.resolve(axios({
Promise.resolve(axios({
method: 'DELETE',
url: url + '/offline-payments/settings/delete',
data: {
code: this.confirm.code
}
}));

promise.then(response => {
})).then(response => {
var type = (response.data.success) ? 'success' : 'warning';

if (response.data.success) {
if (response.data.redirect) {
//window.location.href = response.data.redirect;
}

document.getElementById('method-' + this.confirm.code).remove();
}

Expand All @@ -111,7 +99,7 @@ const app = new Vue({
this.$notify({
message: response.data.message,
timeout: 5000,
icon: 'fas fa-bell',
icon: 'info',
type
});
})
Expand Down
48 changes: 12 additions & 36 deletions Resources/assets/js/offline-payments.min.js

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions Resources/lang/en-GB/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

return [

'name' => 'Offline Payments',
'description' => 'Create unlimited payment options for admin usage',
'name' => 'Offline Payments',
'description' => 'Create unlimited payment options for admin usage',

'add_new' => 'Add New',
'edit' => 'Edit: :method',
'add_new' => 'Add New',
'edit' => 'Edit: :method',

'form' => [
'code' => 'Code',
'customer' => 'Show to Customer',
'order' => 'Order'
'code' => 'Code',
'customer' => 'Show to Customer',
'order' => 'Order'
],

'methods' => 'Method|Methods',
'methods' => 'Method|Methods',

'payment_gateways' => 'Offline Payment Methods',
'payment_gateways' => 'Offline Payment Methods',
'gateways_description' => 'Manage All Offline Payment Methods',

];
Loading

0 comments on commit 71b80d1

Please sign in to comment.