Merge branch 'akaunting:master' into master

This commit is contained in:
merve karaman 2023-08-23 14:46:18 +03:00 committed by GitHub
commit d420f839bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 249 additions and 14 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
use App\Models\Banking\Account;
class AccountCreated extends Event
{
public $account;
/**
* Create a new event instance.
*
* @param $account
*/
public function __construct(Account $account)
{
$this->account = $account;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
class AccountCreating extends Event
{
public $request;
/**
* Create a new event instance.
*
* @param $request
*/
public function __construct($request)
{
$this->request = $request;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
class AccountDeleted extends Event
{
public $account;
/**
* Create a new event instance.
*
* @param $account
*/
public function __construct($account)
{
$this->account = $account;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
class AccountDeleting extends Event
{
public $account;
/**
* Create a new event instance.
*
* @param $account
*/
public function __construct($account)
{
$this->account = $account;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
use App\Models\Banking\Account;
class AccountUpdated extends Event
{
public $account;
public $request;
/**
* Create a new event instance.
*
* @param $account
* @param $request
*/
public function __construct(Account $account, $request)
{
$this->account = $account;
$this->request = $request;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
use App\Models\Banking\Account;
class AccountUpdating extends Event
{
public $account;
public $request;
/**
* Create a new event instance.
*
* @param $account
* @param $request
*/
public function __construct(Account $account, $request)
{
$this->account = $account;
$this->request = $request;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
class TransactionDeleted extends Event
{
public $transaction;
/**
* Create a new event instance.
*
* @param $transaction
*/
public function __construct($transaction)
{
$this->transaction = $transaction;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Events\Banking;
use App\Abstracts\Event;
class TransactionDeleting extends Event
{
public $transaction;
/**
* Create a new event instance.
*
* @param $transaction
*/
public function __construct($transaction)
{
$this->transaction = $transaction;
}
}

View File

@ -3,6 +3,8 @@
namespace App\Jobs\Banking; namespace App\Jobs\Banking;
use App\Abstracts\Job; use App\Abstracts\Job;
use App\Events\Banking\AccountCreating;
use App\Events\Banking\AccountCreated;
use App\Interfaces\Job\HasOwner; use App\Interfaces\Job\HasOwner;
use App\Interfaces\Job\HasSource; use App\Interfaces\Job\HasSource;
use App\Interfaces\Job\ShouldCreate; use App\Interfaces\Job\ShouldCreate;
@ -12,6 +14,8 @@ class CreateAccount extends Job implements HasOwner, HasSource, ShouldCreate
{ {
public function handle(): Account public function handle(): Account
{ {
event(new AccountCreating($this->request));
\DB::transaction(function () { \DB::transaction(function () {
$this->model = Account::create($this->request->all()); $this->model = Account::create($this->request->all());
@ -22,6 +26,8 @@ class CreateAccount extends Job implements HasOwner, HasSource, ShouldCreate
} }
}); });
event(new AccountCreated($this->model, $this->request));
return $this->model; return $this->model;
} }
} }

View File

@ -3,6 +3,8 @@
namespace App\Jobs\Banking; namespace App\Jobs\Banking;
use App\Abstracts\Job; use App\Abstracts\Job;
use App\Events\Banking\AccountDeleting;
use App\Events\Banking\AccountDeleted;
use App\Interfaces\Job\ShouldDelete; use App\Interfaces\Job\ShouldDelete;
class DeleteAccount extends Job implements ShouldDelete class DeleteAccount extends Job implements ShouldDelete
@ -11,10 +13,14 @@ class DeleteAccount extends Job implements ShouldDelete
{ {
$this->authorize(); $this->authorize();
event(new AccountDeleting($this->model));
\DB::transaction(function () { \DB::transaction(function () {
$this->model->delete(); $this->model->delete();
}); });
event(new AccountDeleted($this->model));
return true; return true;
} }

View File

@ -3,6 +3,8 @@
namespace App\Jobs\Banking; namespace App\Jobs\Banking;
use App\Abstracts\Job; use App\Abstracts\Job;
use App\Events\Banking\TransactionDeleting;
use App\Events\Banking\TransactionDeleted;
use App\Interfaces\Job\ShouldDelete; use App\Interfaces\Job\ShouldDelete;
class DeleteTransaction extends Job implements ShouldDelete class DeleteTransaction extends Job implements ShouldDelete
@ -11,11 +13,15 @@ class DeleteTransaction extends Job implements ShouldDelete
{ {
$this->authorize(); $this->authorize();
event(new TransactionDeleting($this->model));
\DB::transaction(function () { \DB::transaction(function () {
$this->model->recurring()->delete(); $this->model->recurring()->delete();
$this->model->delete(); $this->model->delete();
}); });
event(new TransactionDeleted($this->model));
return true; return true;
} }

View File

@ -3,6 +3,8 @@
namespace App\Jobs\Banking; namespace App\Jobs\Banking;
use App\Abstracts\Job; use App\Abstracts\Job;
use App\Events\Banking\AccountUpdating;
use App\Events\Banking\AccountUpdated;
use App\Interfaces\Job\ShouldUpdate; use App\Interfaces\Job\ShouldUpdate;
use App\Models\Banking\Account; use App\Models\Banking\Account;
@ -12,6 +14,8 @@ class UpdateAccount extends Job implements ShouldUpdate
{ {
$this->authorize(); $this->authorize();
event(new AccountUpdating($this->model, $this->request));
\DB::transaction(function () { \DB::transaction(function () {
$this->model->update($this->request->all()); $this->model->update($this->request->all());
@ -22,6 +26,8 @@ class UpdateAccount extends Job implements ShouldUpdate
} }
}); });
event(new AccountUpdated($this->model, $this->request));
return $this->model; return $this->model;
} }

68
presets.js vendored
View File

@ -251,25 +251,65 @@ module.exports = {
}, },
'status': { 'status': {
'success': '#F1F6EE', 'success': '#F1F6EE',
'danger': '#fae6e6', 'danger': '#fae6e6',
'sent': '#FEF5E7', 'warning': '#FEF5E7',
'viewed': '#EEEEF3', 'info': '#e6f1f6',
'draft': '#ECECEC', 'sent': '#FEF5E7',
'partial': '#E6F1F6', 'viewed': '#EEEEF3',
'draft': '#ECECEC',
'partial': '#E6F1F6',
'canceled': '#282828', 'canceled': '#282828',
'warning': '#FEF5E7' 'approved': '#F1F6EE',
'invoiced': '#CCE0D0',
'refused': '#fae6e6',
'expired': '#fae6e6',
'confirmed': '#F1F6EE',
'issued': '#fae6e6',
'green': '#f1f6ee',
'purple': '#eeeef3',
'red': '#fae6e6',
'orange': '#fef5e7',
'blue': '#e6f1f6',
'black': '#ececec',
'lilac': '#F5F7FA',
'golden': '',
'rose': '#ffe4e6',
'silver': '#D4D7DC',
'pastel_green': '#CCE0D0',
'peach_orange': '#F0E0BE',
'wisteria': '#D0CEE8',
}, },
'text-status': { 'text-status': {
'success': '#63914A', 'success': '#63914A',
'danger': '#B80000', 'danger': '#B80000',
'sent': '#DD8E0A', 'warning': '#b87708',
'viewed': '#4D4F7D', 'info': '#006395',
'draft': '#3B3B3B', 'sent': '#DD8E0A',
'partial': '#006395', 'viewed': '#4D4F7D',
'draft': '#3B3B3B',
'partial': '#006395',
'canceled': '#ffffff', 'canceled': '#ffffff',
'warning': '#b87708' 'approved': '#63914A',
'invoiced': '#678D72',
'refused': '#b80000',
'expired': '#B80000',
'confirmed': '#63914A',
'issued': '#b80000',
'green': '#63914a',
'purple': '#4d4f7d',
'red': '#b80000',
'orange': '#dd8e0a',
'blue': '#006395',
'black': '#3b3b3b',
'lilac': '',
'golden': '',
'rose': '#e11d48',
'silver': '#475569',
'pastel_green': '#678D72',
'peach_orange': '#B78939',
'wisteria': '#65638C'
}, },
'body': { 'body': {