diff --git a/app/Abstracts/View/Components/Contacts/Index.php b/app/Abstracts/View/Components/Contacts/Index.php index 0fe2b5ef0..bc55a201b 100644 --- a/app/Abstracts/View/Components/Contacts/Index.php +++ b/app/Abstracts/View/Components/Contacts/Index.php @@ -282,7 +282,7 @@ abstract class Index extends Component foreach ($totals as $key => $total) { $items[] = [ 'title' => ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key), - 'href' => route($route, ['search' => 'status:' . $key]), + //'href' => route($route, ['search' => 'status:' . $key]), 'amount' => money($total, setting('default.currency'), true)->formatForHumans(), 'tooltip' => money($total, setting('default.currency'), true)->format(), ]; diff --git a/app/Abstracts/View/Components/Documents/Index.php b/app/Abstracts/View/Components/Documents/Index.php index 0fc38f681..e47840939 100644 --- a/app/Abstracts/View/Components/Documents/Index.php +++ b/app/Abstracts/View/Components/Documents/Index.php @@ -397,7 +397,7 @@ abstract class Index extends Component $items[] = [ 'title' => $title, - 'href' => $href, + //'href' => $href, 'amount' => $amount, 'tooltip' => $tooltip, ]; diff --git a/app/Http/Controllers/Api/Settings/Settings.php b/app/Http/Controllers/Api/Settings/Settings.php index 5ef7af136..29210cb3c 100644 --- a/app/Http/Controllers/Api/Settings/Settings.php +++ b/app/Http/Controllers/Api/Settings/Settings.php @@ -6,6 +6,8 @@ use App\Abstracts\Http\ApiController; use App\Http\Requests\Setting\Setting as Request; use App\Http\Resources\Setting\Setting as Resource; use App\Models\Setting\Setting; +use Laratrust\Middleware\LaratrustMiddleware; + class Settings extends ApiController { @@ -15,9 +17,10 @@ class Settings extends ApiController public function __construct() { // Add CRUD permission check - $this->middleware('permission:create-settings-settings')->only('create', 'store', 'duplicate', 'import'); - $this->middleware('permission:read-settings-settings')->only('index', 'show', 'edit', 'export'); - $this->middleware('permission:update-settings-settings')->only('update', 'enable', 'disable', 'destroy'); + // We've added base 3 permission then get all setting thsi permissions + $this->middleware('permission:create-settings-company|create-settings-defaults|create-settings-localisation')->only('create', 'store', 'duplicate', 'import'); + $this->middleware('permission:read-settings-company|read-settings-defaults|read-settings-localisation')->only('index', 'show', 'edit', 'export'); + $this->middleware('permission:update-settings-company|update-settings-defaults|update-settings-localisation')->only('update', 'enable', 'disable', 'destroy'); } /** diff --git a/app/Http/Controllers/Modals/DocumentTransactions.php b/app/Http/Controllers/Modals/DocumentTransactions.php index 687d674f8..2e1654535 100644 --- a/app/Http/Controllers/Modals/DocumentTransactions.php +++ b/app/Http/Controllers/Modals/DocumentTransactions.php @@ -113,13 +113,7 @@ class DocumentTransactions extends Controller $response = $this->ajaxDispatch(new CreateBankingDocumentTransaction($document, $request)); if ($response['success']) { - $route = config('type.document.' . $document->type . '.route.prefix'); - - if ($alias = config('type.document.' . $document->type . '.alias')) { - $route = $alias . '.' . $route; - } - - $response['redirect'] = route($route . '.show', $document->id); + $response['redirect'] = url()->previous(); $message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]); diff --git a/app/Http/Controllers/Wizard/Currencies.php b/app/Http/Controllers/Wizard/Currencies.php index 6b5eb4481..2a45f5200 100644 --- a/app/Http/Controllers/Wizard/Currencies.php +++ b/app/Http/Controllers/Wizard/Currencies.php @@ -91,6 +91,8 @@ class Currencies extends Controller { $response = $this->ajaxDispatch(new UpdateCurrency($currency, $request)); + $currency->default = setting('default.currency') == $currency->code; + if ($response['success']) { $message = trans('messages.success.updated', ['type' => $currency->name]); } else { diff --git a/app/Http/Livewire/Report/Pin.php b/app/Http/Livewire/Report/Pin.php index 31d5d3336..8c41b7e55 100644 --- a/app/Http/Livewire/Report/Pin.php +++ b/app/Http/Livewire/Report/Pin.php @@ -13,7 +13,7 @@ class Pin extends Component public $pinned = false; - public $reportId = null; + public $report; public function render(): View { @@ -38,7 +38,7 @@ class Pin extends Component continue; } - if (in_array($this->reportId, $pins)) { + if (in_array($this->report->id, $pins)) { $this->pinned = true; break; diff --git a/app/Jobs/Banking/UpdateReconciliation.php b/app/Jobs/Banking/UpdateReconciliation.php index 8825f2b61..8e12697f4 100644 --- a/app/Jobs/Banking/UpdateReconciliation.php +++ b/app/Jobs/Banking/UpdateReconciliation.php @@ -15,19 +15,22 @@ class UpdateReconciliation extends Job implements ShouldUpdate $reconcile = (int) $this->request->get('reconcile'); $transactions = $this->request->get('transactions'); + $this->model->transactions = $transactions; $this->model->reconciled = $reconcile; $this->model->save(); if ($transactions) { foreach ($transactions as $key => $value) { - if (empty($value)) { - continue; + $transaction_reconcile = $reconcile; + + if (empty($value) || $value === 'false') { + $transaction_reconcile = 0; } $t = explode('_', $key); $transaction = Transaction::find($t[1]); - $transaction->reconciled = $reconcile; + $transaction->reconciled = $transaction_reconcile; $transaction->save(); } } diff --git a/app/Models/Auth/Role.php b/app/Models/Auth/Role.php index aac0e0717..5e5aebada 100644 --- a/app/Models/Auth/Role.php +++ b/app/Models/Auth/Role.php @@ -43,6 +43,9 @@ class Role extends LaratrustRole 'icon' => 'edit', 'url' => route('roles.roles.edit', $this->id), 'permission' => 'update-roles-roles', + 'attributes' => [ + 'id' => 'index-line-actions-edit-role-' . $this->id, + ], ]; $actions[] = [ @@ -50,6 +53,9 @@ class Role extends LaratrustRole 'icon' => 'file_copy', 'url' => route('roles.roles.duplicate', $this->id), 'permission' => 'create-roles-roles', + 'attributes' => [ + 'id' => 'index-line-actions-duplicate-role-' . $this->id, + ], ]; $actions[] = [ @@ -57,6 +63,9 @@ class Role extends LaratrustRole 'icon' => 'delete', 'route' => 'roles.roles.destroy', 'permission' => 'delete-roles-roles', + 'attributes' => [ + 'id' => 'index-line-actions-delete-role-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php index 819e7f5b7..e8485b688 100644 --- a/app/Models/Auth/User.php +++ b/app/Models/Auth/User.php @@ -326,6 +326,9 @@ class User extends Authenticatable implements HasLocalePreference 'icon' => 'edit', 'url' => route('users.edit', $this->id), 'permission' => 'update-auth-users', + 'attributes' => [ + 'id' => 'index-line-actions-show-user-' . $this->id, + ], ]; if ($this->hasPendingInvitation()) { @@ -334,6 +337,9 @@ class User extends Authenticatable implements HasLocalePreference 'icon' => 'replay', 'url' => route('users.invite', $this->id), 'permission' => 'update-auth-users', + 'attributes' => [ + 'id' => 'index-line-actions-resend-user-' . $this->id, + ], ]; } @@ -342,6 +348,9 @@ class User extends Authenticatable implements HasLocalePreference 'icon' => 'delete', 'route' => 'users.destroy', 'permission' => 'delete-auth-users', + 'attributes' => [ + 'id' => 'index-line-actions-delete-user-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Banking/Account.php b/app/Models/Banking/Account.php index e2b31976d..c29751a95 100644 --- a/app/Models/Banking/Account.php +++ b/app/Models/Banking/Account.php @@ -170,6 +170,9 @@ class Account extends Model 'icon' => 'visibility', 'url' => route('accounts.show', $this->id), 'permission' => 'read-banking-accounts', + 'attributes' => [ + 'id' => 'index-line-actions-show-account-' . $this->id, + ], ]; $actions[] = [ @@ -177,6 +180,9 @@ class Account extends Model 'icon' => 'edit', 'url' => route('accounts.edit', $this->id), 'permission' => 'update-banking-accounts', + 'attributes' => [ + 'id' => 'index-line-actions-edit-account-' . $this->id, + ], ]; $actions[] = [ @@ -185,6 +191,9 @@ class Account extends Model 'route' => 'accounts.destroy', 'permission' => 'delete-banking-accounts', 'model' => $this, + 'attributes' => [ + 'id' => 'index-line-actions-delete-account-' . $this->id, + ], ]; return $actions; diff --git a/app/Models/Banking/Reconciliation.php b/app/Models/Banking/Reconciliation.php index 738a75d27..c8d2fd87f 100644 --- a/app/Models/Banking/Reconciliation.php +++ b/app/Models/Banking/Reconciliation.php @@ -28,6 +28,7 @@ class Reconciliation extends Model protected $casts = [ 'closing_balance' => 'double', 'reconciled' => 'boolean', + 'transactions' => 'array', ]; /** @@ -56,6 +57,9 @@ class Reconciliation extends Model 'icon' => 'edit', 'url' => route('reconciliations.edit', $this->id), 'permission' => 'update-banking-reconciliations', + 'attributes' => [ + 'id' => 'index-line-actions-edit-reconciliation-' . $this->id, + ], ]; $actions[] = [ @@ -63,6 +67,9 @@ class Reconciliation extends Model 'icon' => 'delete', 'route' => 'reconciliations.destroy', 'permission' => 'delete-banking-reconciliations', + 'attributes' => [ + 'id' => 'index-line-actions-delete-reconciliation-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php index 5f5505484..c2fca7d0e 100644 --- a/app/Models/Banking/Transaction.php +++ b/app/Models/Banking/Transaction.php @@ -455,7 +455,7 @@ class Transaction extends Model 'url' => route($prefix. '.show', $this->id), 'permission' => 'read-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-show-' . $this->id, + 'id' => 'index-line-actions-show-' . $this->type . '-' . $this->id, ], ]; } catch (\Exception $e) {} @@ -468,7 +468,7 @@ class Transaction extends Model 'url' => route($prefix. '.edit', $this->id), 'permission' => 'update-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-edit-' . $this->id, + 'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id, ], ]; } @@ -482,7 +482,7 @@ class Transaction extends Model 'url' => route($prefix. '.duplicate', $this->id), 'permission' => 'create-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-duplicate-' . $this->id, + 'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id, ], ]; } @@ -496,7 +496,7 @@ class Transaction extends Model 'icon' => 'sensors', 'permission' => 'create-banking-transactions', 'attributes' => [ - 'id' => 'index-transactions-more-actions-connect-' . $this->id, + 'id' => 'index-line-actions-connect-' . $this->type . '-' . $this->id, '@click' => 'onConnectTransactions(\'' . route('transactions.dial', $this->id) . '\')', ], ]; @@ -516,7 +516,7 @@ class Transaction extends Model 'url' => route($prefix. '.print', $this->id), 'permission' => 'read-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-print-' . $this->id, + 'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id, 'target' => '_blank', ], ]; @@ -529,7 +529,7 @@ class Transaction extends Model 'url' => route($prefix. '.pdf', $this->id), 'permission' => 'read-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-pdf-' . $this->id, + 'id' => 'index-line-actions-pdf-' . $this->type . '-' . $this->id, 'target' => '_blank', ], ]; @@ -549,7 +549,7 @@ class Transaction extends Model 'url' => route('modals.transactions.share.create', $this->id), 'permission' => 'read-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-share-' . $this->id, + 'id' => 'index-line-actions-share-' . $this->type . '-' . $this->id, '@click' => 'onShareLink("' . route('modals.transactions.share.create', $this->id) . '")', ], ]; @@ -564,7 +564,7 @@ class Transaction extends Model 'url' => route('modals.transactions.emails.create', $this->id), 'permission' => 'read-banking-transactions', 'attributes' => [ - 'id' => 'index-more-actions-send-email-' . $this->id, + 'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id, '@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")', ], ]; @@ -583,6 +583,9 @@ class Transaction extends Model 'text' => ! empty($this->recurring) ? 'transactions' : 'recurring_template', 'route' => $prefix. '.destroy', 'permission' => 'delete-banking-transactions', + 'attributes' => [ + 'id' => 'index-line-actions-delete-' . $this->type . '-' . $this->id, + ], 'model' => $this, ]; } @@ -595,6 +598,9 @@ class Transaction extends Model 'icon' => 'block', 'url' => route($prefix. '.end', $this->id), 'permission' => 'update-banking-transactions', + 'attributes' => [ + 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id, + ], ]; } catch (\Exception $e) {} } diff --git a/app/Models/Banking/Transfer.php b/app/Models/Banking/Transfer.php index bd1d92c53..f1b41c1f3 100644 --- a/app/Models/Banking/Transfer.php +++ b/app/Models/Banking/Transfer.php @@ -246,6 +246,9 @@ class Transfer extends Model 'icon' => 'visibility', 'url' => route('transfers.show', $this->id), 'permission' => 'read-banking-transfers', + 'attributes' => [ + 'id' => 'index-line-actions-show-transfer-' . $this->id, + ], ]; $actions[] = [ @@ -253,6 +256,9 @@ class Transfer extends Model 'icon' => 'edit', 'url' => route('transfers.edit', $this->id), 'permission' => 'update-banking-transfers', + 'attributes' => [ + 'id' => 'index-line-actions-edit-transfer-' . $this->id, + ], ]; $actions[] = [ @@ -260,6 +266,9 @@ class Transfer extends Model 'icon' => 'file_copy', 'url' => route('transfers.duplicate', $this->id), 'permission' => 'update-banking-transfers', + 'attributes' => [ + 'id' => 'index-line-actions-duplicate-transfer-' . $this->id, + ], ]; $actions[] = [ @@ -267,6 +276,9 @@ class Transfer extends Model 'icon' => 'delete', 'route' => 'transfers.destroy', 'permission' => 'delete-banking-transfers', + 'attributes' => [ + 'id' => 'index-line-actions-delete-transfer-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php index 79bbe5d8d..6e8484988 100644 --- a/app/Models/Common/Company.php +++ b/app/Models/Common/Company.php @@ -70,7 +70,7 @@ class Company extends Eloquent implements Ownable { parent::boot(); - try { + try { // TODO will optimize.. static::retrieved(function($model) { $model->setCommonSettingsAsAttributes(); @@ -550,6 +550,9 @@ class Company extends Eloquent implements Ownable 'icon' => 'settings_ethernet', 'url' => route('companies.switch', $this->id), 'permission' => 'read-common-companies', + 'attributes' => [ + 'id' => 'index-line-actions-switch-company-' . $this->id, + ], ]; } @@ -558,6 +561,9 @@ class Company extends Eloquent implements Ownable 'icon' => 'edit', 'url' => route('companies.edit', $this->id), 'permission' => 'update-common-companies', + 'attributes' => [ + 'id' => 'index-line-actions-edit-company-' . $this->id, + ], ]; $actions[] = [ @@ -565,6 +571,9 @@ class Company extends Eloquent implements Ownable 'icon' => 'delete', 'route' => 'companies.destroy', 'permission' => 'delete-common-companies', + 'attributes' => [ + 'id' => 'index-line-actions-delete-company-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Common/Contact.php b/app/Models/Common/Contact.php index 31fbe4547..59f3b3a6f 100644 --- a/app/Models/Common/Contact.php +++ b/app/Models/Common/Contact.php @@ -291,6 +291,9 @@ class Contact extends Model 'icon' => 'visibility', 'url' => route($prefix . '.show', $this->id), 'permission' => 'read-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-show-' . $this->type . '-' . $this->id, + ], ]; } catch (\Exception $e) {} @@ -300,6 +303,9 @@ class Contact extends Model 'icon' => 'edit', 'url' => route($prefix . '.edit', $this->id), 'permission' => 'update-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id, + ], ]; } catch (\Exception $e) {} @@ -309,6 +315,9 @@ class Contact extends Model 'icon' => 'file_copy', 'url' => route($prefix . '.duplicate', $this->id), 'permission' => 'create-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id, + ], ]; } catch (\Exception $e) {} @@ -319,6 +328,9 @@ class Contact extends Model 'title' => $translation_prefix, 'route' => $prefix . '.destroy', 'permission' => 'delete-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-delete-' . $this->type . '-' . $this->id, + ], 'model' => $this, ]; } catch (\Exception $e) {} diff --git a/app/Models/Common/Dashboard.php b/app/Models/Common/Dashboard.php index 87518173a..e344d3310 100644 --- a/app/Models/Common/Dashboard.php +++ b/app/Models/Common/Dashboard.php @@ -129,6 +129,9 @@ class Dashboard extends Model 'icon' => 'settings_ethernet', 'url' => route('dashboards.switch', $this->id), 'permission' => 'read-common-dashboards', + 'attributes' => [ + 'id' => 'index-line-actions-switch-dashboard-' . $this->id, + ], ]; } @@ -137,6 +140,9 @@ class Dashboard extends Model 'icon' => 'edit', 'url' => route('dashboards.edit', $this->id), 'permission' => 'update-common-dashboards', + 'attributes' => [ + 'id' => 'index-line-actions-edit-dashboard-' . $this->id, + ], ]; $actions[] = [ @@ -144,6 +150,9 @@ class Dashboard extends Model 'icon' => 'delete', 'route' => 'dashboards.destroy', 'permission' => 'delete-common-dashboards', + 'attributes' => [ + 'id' => 'index-line-actions-delete-dashboard-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Common/Item.php b/app/Models/Common/Item.php index 217190d9d..58b3c1810 100644 --- a/app/Models/Common/Item.php +++ b/app/Models/Common/Item.php @@ -174,6 +174,9 @@ class Item extends Model 'icon' => 'edit', 'url' => route('items.edit', $this->id), 'permission' => 'update-common-items', + 'attributes' => [ + 'id' => 'index-line-actions-edit-item-' . $this->id, + ], ]; $actions[] = [ @@ -181,6 +184,9 @@ class Item extends Model 'icon' => 'file_copy', 'url' => route('items.duplicate', $this->id), 'permission' => 'create-common-items', + 'attributes' => [ + 'id' => 'index-line-actions-duplicate-item-' . $this->id, + ], ]; $actions[] = [ @@ -188,6 +194,9 @@ class Item extends Model 'icon' => 'delete', 'route' => 'items.destroy', 'permission' => 'delete-common-items', + 'attributes' => [ + 'id' => 'index-line-actions-delete-item-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php index 85aec2158..5dd405fc2 100644 --- a/app/Models/Document/Document.php +++ b/app/Models/Document/Document.php @@ -488,18 +488,6 @@ class Document extends Model return $actions; } - try { - $actions[] = [ - 'title' => trans('general.show'), - 'icon' => 'visibility', - 'url' => route($prefix . '.show', $this->id), - 'permission' => 'read-' . $group . '-' . $permission_prefix, - 'attributes' => [ - 'id' => 'index-more-actions-show-' . $this->id, - ], - ]; - } catch (\Exception $e) {} - try { if (! $this->reconciled) { $actions[] = [ @@ -508,7 +496,7 @@ class Document extends Model 'url' => route($prefix . '.edit', $this->id), 'permission' => 'update-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-edit-' . $this->id, + 'id' => 'index-line-actions-edit-' . $this->type . '-' . $this->id, ], ]; } @@ -521,12 +509,26 @@ class Document extends Model 'url' => route($prefix . '.duplicate', $this->id), 'permission' => 'create-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-duplicate-' . $this->id, + 'id' => 'index-line-actions-duplicate-' . $this->type . '-' . $this->id, ], ]; } catch (\Exception $e) {} - if ($this->status != 'cancelled') { + if ((empty($this->transactions->count()) || (! empty($this->transactions->count()) && $this->paid != $this->amount))) { + try { + $actions[] = [ + 'type' => 'button', + 'title' => trans('invoices.add_payment'), + 'icon' => 'paid', + 'url' => route('modals.documents.document.transactions.create', $this->id), + 'permission' => 'read-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-payment-' . $this->type . '-' . $this->id, + '@click' => 'onPayment("' . $this->id . '")', + ], + ]; + } catch (\Exception $e) {} + } else { try { $actions[] = [ 'title' => trans('general.print'), @@ -534,7 +536,22 @@ class Document extends Model 'url' => route($prefix . '.print', $this->id), 'permission' => 'read-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-print-' . $this->id, + 'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id, + 'target' => '_blank', + ], + ]; + } catch (\Exception $e) {} + } + + if (($actions[1]['icon'] != 'print') && ($actions[2]['icon'] != 'print')) { + try { + $actions[] = [ + 'title' => trans('general.print'), + 'icon' => 'print', + 'url' => route($prefix . '.print', $this->id), + 'permission' => 'read-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-print-' . $this->type . '-' . $this->id, 'target' => '_blank', ], ]; @@ -548,7 +565,7 @@ class Document extends Model 'url' => route($prefix . '.pdf', $this->id), 'permission' => 'read-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-pdf-' . $this->id, + 'id' => 'index-line-actions-pdf-' . $this->type . '-' . $this->id, 'target' => '_blank', ], ]; @@ -568,14 +585,14 @@ class Document extends Model 'url' => route('modals.'. $prefix . '.share.create', $this->id), 'permission' => 'read-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-share-link-' . $this->id, + 'id' => 'index-line-actions-share-link-' . $this->type . '-' . $this->id, '@click' => 'onShareLink("' . route('modals.'. $prefix . '.share.create', $this->id) . '")', ], ]; } catch (\Exception $e) {} try { - if (! empty($this->contact) && $this->contact->email && $this->type == 'invoice') { + if (! empty($this->contact) && $this->contact->email && ($this->type == 'invoice')) { $actions[] = [ 'type' => 'button', 'title' => trans('invoices.send_mail'), @@ -583,8 +600,8 @@ class Document extends Model 'url' => route('modals.'. $prefix . '.emails.create', $this->id), 'permission' => 'read-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-send-email-' . $this->id, - '@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")', + 'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id, + '@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")', ], ]; } @@ -603,7 +620,7 @@ class Document extends Model 'url' => route($prefix . '.cancelled', $this->id), 'permission' => 'update-' . $group . '-' . $permission_prefix, 'attributes' => [ - 'id' => 'index-more-actions-cancel-' . $this->id, + 'id' => 'index-line-actions-cancel-' . $this->type . '-' . $this->id, ], ]; } catch (\Exception $e) {} @@ -620,6 +637,9 @@ class Document extends Model 'title' => $translation_prefix, 'route' => $prefix . '.destroy', 'permission' => 'delete-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-delete-' . $this->type . '-' . $this->id, + ], 'model' => $this, ]; } catch (\Exception $e) {} @@ -630,6 +650,9 @@ class Document extends Model 'icon' => 'block', 'url' => route($prefix. '.end', $this->id), 'permission' => 'update-' . $group . '-' . $permission_prefix, + 'attributes' => [ + 'id' => 'index-line-actions-end-' . $this->type . '-' . $this->id, + ], ]; } catch (\Exception $e) {} } diff --git a/app/Models/Setting/Category.php b/app/Models/Setting/Category.php index 826717051..e2c31549f 100644 --- a/app/Models/Setting/Category.php +++ b/app/Models/Setting/Category.php @@ -240,6 +240,9 @@ class Category extends Model 'icon' => 'create', 'url' => route('categories.edit', $this->id), 'permission' => 'update-settings-categories', + 'attributes' => [ + 'id' => 'index-line-actions-edit-category-' . $this->id, + ], ]; if ($this->isTransferCategory()) { @@ -251,6 +254,9 @@ class Category extends Model 'icon' => 'delete', 'route' => 'categories.destroy', 'permission' => 'delete-settings-categories', + 'attributes' => [ + 'id' => 'index-line-actions-delete-category-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Setting/Currency.php b/app/Models/Setting/Currency.php index 3b6ee0da1..264c9e0b9 100644 --- a/app/Models/Setting/Currency.php +++ b/app/Models/Setting/Currency.php @@ -197,6 +197,9 @@ class Currency extends Model 'icon' => 'edit', 'url' => route('currencies.edit', $this->id), 'permission' => 'update-settings-currencies', + 'attributes' => [ + 'id' => 'index-line-actions-edit-currency-' . $this->id, + ], ]; $actions[] = [ @@ -204,6 +207,9 @@ class Currency extends Model 'icon' => 'delete', 'route' => 'currencies.destroy', 'permission' => 'delete-settings-currencies', + 'attributes' => [ + 'id' => 'index-line-actions-delete-currency-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Models/Setting/Tax.php b/app/Models/Setting/Tax.php index c30920015..5d8417687 100644 --- a/app/Models/Setting/Tax.php +++ b/app/Models/Setting/Tax.php @@ -150,6 +150,9 @@ class Tax extends Model 'icon' => 'edit', 'url' => route('taxes.edit', $this->id), 'permission' => 'update-settings-taxes', + 'attributes' => [ + 'id' => 'index-line-actions-edit-tax-' . $this->id, + ], ]; $actions[] = [ @@ -157,6 +160,9 @@ class Tax extends Model 'icon' => 'delete', 'route' => 'taxes.destroy', 'permission' => 'delete-settings-taxes', + 'attributes' => [ + 'id' => 'index-line-actions-delete-tax-' . $this->id, + ], 'model' => $this, ]; diff --git a/app/Traits/Transactions.php b/app/Traits/Transactions.php index 0758a2826..bc40b37f8 100644 --- a/app/Traits/Transactions.php +++ b/app/Traits/Transactions.php @@ -51,6 +51,18 @@ trait Transactions return Str::endsWith($type, '-transfer'); } + public function isDocumentTransaction(): bool + { + $document_id = $this->document_id ?? $this->transaction->document_id ?? $this->model->document_id ?? null; + + return ! empty($document_id); + } + + public function isNotDocumentTransaction(): bool + { + return ! $this->isDocumentTransaction(); + } + public function isNotTransferTransaction(): bool { return ! $this->isTransferTransaction(); diff --git a/app/View/Components/Layouts/Wizard/Scripts.php b/app/View/Components/Layouts/Wizard/Scripts.php index 7b3de49db..14304ac4d 100644 --- a/app/View/Components/Layouts/Wizard/Scripts.php +++ b/app/View/Components/Layouts/Wizard/Scripts.php @@ -103,6 +103,7 @@ class Scripts extends Component 'name' => trans('general.name'), 'code' => trans('currencies.code'), 'rate' => trans('currencies.rate'), + 'default' => trans('currencies.default'), 'enabled' => trans('general.enabled'), 'actions' => trans('general.actions') , 'yes' => trans('general.yes'), @@ -162,7 +163,15 @@ class Scripts extends Component protected function getCurrencies() { - return Currency::all(); + $currencies = collect(); + + Currency::all()->each(function ($currency) use (&$currencies) { + $currency->default = setting('default.currency') == $currency->code; + + $currencies->push($currency); + }); + + return $currencies; } protected function getCurrencyCodes() diff --git a/composer.lock b/composer.lock index 87a3ede83..092c66d2f 100644 --- a/composer.lock +++ b/composer.lock @@ -907,16 +907,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.234.5", + "version": "3.235.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "0293e7b4684827688dba3f3b58d99778a99156ae" + "reference": "2025db05c7dd22ae414857dadd49207f64c2fc74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0293e7b4684827688dba3f3b58d99778a99156ae", - "reference": "0293e7b4684827688dba3f3b58d99778a99156ae", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2025db05c7dd22ae414857dadd49207f64c2fc74", + "reference": "2025db05c7dd22ae414857dadd49207f64c2fc74", "shasum": "" }, "require": { @@ -993,9 +993,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.234.5" + "source": "https://github.com/aws/aws-sdk-php/tree/3.235.1" }, - "time": "2022-08-29T19:14:31+00:00" + "time": "2022-09-02T18:18:19+00:00" }, { "name": "balping/json-raw-encoder", @@ -1842,16 +1842,16 @@ }, { "name": "doctrine/dbal", - "version": "3.4.2", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "22de295f10edbe00df74f517612f1fbd711131e2" + "reference": "4cbbe6e4b9ef6c69d5f4c968c637476f47bb54f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/22de295f10edbe00df74f517612f1fbd711131e2", - "reference": "22de295f10edbe00df74f517612f1fbd711131e2", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/4cbbe6e4b9ef6c69d5f4c968c637476f47bb54f5", + "reference": "4cbbe6e4b9ef6c69d5f4c968c637476f47bb54f5", "shasum": "" }, "require": { @@ -1864,16 +1864,16 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2022.1", - "phpstan/phpstan": "1.8.2", + "doctrine/coding-standard": "10.0.0", + "jetbrains/phpstorm-stubs": "2022.2", + "phpstan/phpstan": "1.8.3", "phpstan/phpstan-strict-rules": "^1.3", - "phpunit/phpunit": "9.5.21", + "phpunit/phpunit": "9.5.24", "psalm/plugin-phpunit": "0.17.0", "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^5.4|^6.0", "symfony/console": "^4.4|^5.4|^6.0", - "vimeo/psalm": "4.24.0" + "vimeo/psalm": "4.27.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -1933,7 +1933,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.4.2" + "source": "https://github.com/doctrine/dbal/tree/3.4.4" }, "funding": [ { @@ -1949,7 +1949,7 @@ "type": "tidelift" } ], - "time": "2022-08-21T14:21:06+00:00" + "time": "2022-09-01T21:26:42+00:00" }, { "name": "doctrine/deprecations", @@ -4477,16 +4477,16 @@ }, { "name": "laravel/framework", - "version": "v9.26.1", + "version": "v9.27.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "1ccfb91afee7a351b09ba1f1b97739096a3ad1cf" + "reference": "27572f45120fd3977d92651a71d8c711a9aaa790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/1ccfb91afee7a351b09ba1f1b97739096a3ad1cf", - "reference": "1ccfb91afee7a351b09ba1f1b97739096a3ad1cf", + "url": "https://api.github.com/repos/laravel/framework/zipball/27572f45120fd3977d92651a71d8c711a9aaa790", + "reference": "27572f45120fd3977d92651a71d8c711a9aaa790", "shasum": "" }, "require": { @@ -4653,7 +4653,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-08-23T19:00:07+00:00" + "time": "2022-08-30T13:34:43+00:00" }, { "name": "laravel/sanctum", @@ -4722,25 +4722,26 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.2.0", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540" + "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/09f0e9fb61829f628205b7c94906c28740ff9540", - "reference": "09f0e9fb61829f628205b7c94906c28740ff9540", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/d78fd36ba031a1a695ea5a406f29996948d7011b", + "reference": "d78fd36ba031a1a695ea5a406f29996948d7011b", "shasum": "" }, "require": { "php": "^7.3|^8.0" }, "require-dev": { - "pestphp/pest": "^1.18", - "phpstan/phpstan": "^0.12.98", - "symfony/var-dumper": "^5.3" + "nesbot/carbon": "^2.61", + "pestphp/pest": "^1.21.3", + "phpstan/phpstan": "^1.8.2", + "symfony/var-dumper": "^5.4.11" }, "type": "library", "extra": { @@ -4777,7 +4778,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2022-05-16T17:09:47+00:00" + "time": "2022-08-26T15:25:27+00:00" }, { "name": "laravel/slack-notification-channel", @@ -6530,16 +6531,16 @@ }, { "name": "nesbot/carbon", - "version": "2.62.0", + "version": "2.62.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8" + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7507aec3d626797ce2123cf6c6556683be22b5f8", - "reference": "7507aec3d626797ce2123cf6c6556683be22b5f8", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", + "reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "shasum": "" }, "require": { @@ -6628,7 +6629,7 @@ "type": "tidelift" } ], - "time": "2022-08-28T19:48:05+00:00" + "time": "2022-09-02T07:48:13+00:00" }, { "name": "nette/schema", @@ -6779,16 +6780,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -6829,9 +6830,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "nunomaduro/termwind", @@ -12284,16 +12285,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.16", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073", - "reference": "2593003befdcc10db5e213f9f28814f5aa8ac073", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { @@ -12349,7 +12350,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -12357,7 +12358,7 @@ "type": "github" } ], - "time": "2022-08-20T05:26:47+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -12602,16 +12603,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.23", + "version": "9.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "888556852e7e9bbeeedb9656afe46118765ade34" + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/888556852e7e9bbeeedb9656afe46118765ade34", - "reference": "888556852e7e9bbeeedb9656afe46118765ade34", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", "shasum": "" }, "require": { @@ -12640,7 +12641,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -12684,7 +12685,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" }, "funding": [ { @@ -12696,7 +12697,7 @@ "type": "github" } ], - "time": "2022-08-22T14:01:36+00:00" + "time": "2022-08-30T07:42:16+00:00" }, { "name": "sebastian/cli-parser", @@ -13870,16 +13871,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "71c627a0838f107562e89bc2b0201a81f26e9011" + "reference": "29deea5d9cf921590184be6956e657c4f4566440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/71c627a0838f107562e89bc2b0201a81f26e9011", - "reference": "71c627a0838f107562e89bc2b0201a81f26e9011", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/29deea5d9cf921590184be6956e657c4f4566440", + "reference": "29deea5d9cf921590184be6956e657c4f4566440", "shasum": "" }, "require": { @@ -13956,7 +13957,7 @@ "type": "github" } ], - "time": "2022-08-26T13:28:24+00:00" + "time": "2022-09-01T11:31:14+00:00" }, { "name": "theseer/tokenizer", diff --git a/database/migrations/2022_08_29_000000_core_v307.php b/database/migrations/2022_08_29_000000_core_v307.php index 881befe6a..88ff2ef68 100644 --- a/database/migrations/2022_08_29_000000_core_v307.php +++ b/database/migrations/2022_08_29_000000_core_v307.php @@ -18,10 +18,16 @@ return new class extends Migration if (! Type::hasType('double')) { Type::addType('double', FloatType::class); } - + + // Document Items Schema::table('document_items', function(Blueprint $table) { $table->double('quantity', 12, 2)->change(); }); + + // Reconciliations + Schema::table('reconciliations', function (Blueprint $table) { + $table->text('transactions')->nullable()->after('closing_balance'); + }); } /** diff --git a/public/css/app.css b/public/css/app.css index b6fcc4f3e..9832fdae6 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -48183,8 +48183,8 @@ body{ grid-column: span 8 / span 8; } - .sm\:col-span-7{ - grid-column: span 7 / span 7; + .sm\:col-span-12{ + grid-column: span 12 / span 12; } .sm\:row-span-2{ @@ -48299,6 +48299,10 @@ body{ grid-template-columns: repeat(8, minmax(0, 1fr)); } + .sm\:grid-cols-12{ + grid-template-columns: repeat(12, minmax(0, 1fr)); + } + .sm\:flex-row{ -webkit-box-orient: horizontal; -webkit-box-direction: normal; diff --git a/resources/assets/js/Wizard.vue b/resources/assets/js/Wizard.vue index 895c91921..9a61e052e 100644 --- a/resources/assets/js/Wizard.vue +++ b/resources/assets/js/Wizard.vue @@ -25,7 +25,7 @@ this.modules = wizard_modules; Object.keys(this.currency_codes).map((key) => { - return this.currency_codes[key]; + return this.currency_codes[key]; }); this.page_loaded = false; @@ -34,10 +34,10 @@ data() { return { translations: { - company: {}, - currencies: {}, - taxes: {}, - finish: {}, + company: {}, + currencies: {}, + taxes: {}, + finish: {}, }, company: {}, countries: {}, diff --git a/resources/assets/js/mixins/wizardAction.js b/resources/assets/js/mixins/wizardAction.js index 478617194..d5098f37c 100644 --- a/resources/assets/js/mixins/wizardAction.js +++ b/resources/assets/js/mixins/wizardAction.js @@ -8,6 +8,7 @@ export default { name: "", rate: "", select: "", + default_currency: 0, enabled: 1 }, error_field: {}, @@ -15,6 +16,7 @@ export default { button_loading: false, } }, + methods: { onAddItem() { this.new_datas = true; @@ -25,6 +27,9 @@ export default { this.model.name = ''; this.model.rate = ''; this.model.select = ''; + this.model.default = 0; + this.model.default_currency = 0; + this.model.enabled = 1; } }, @@ -36,6 +41,9 @@ export default { if (this.model) { this.model.name = item.name ? item.name : ''; this.model.rate = item.rate ? item.rate : ''; + this.model.enabled = 1; + this.model.default = item.default ? item.default : 0; + this.model.default_currency = item.default ? item.default : 0; this.model.select = item.code ? item.code : ''; } }, @@ -50,6 +58,8 @@ export default { this.model.name = ''; this.model.rate = ''; this.model.select = ''; + this.model.default = 0; + this.model.default_currency = 0; this.model.enabled = 1; }, @@ -74,8 +84,8 @@ export default { }, onDeleteItemMessage(event) { - let type = event.success ? 'success' : 'error'; - let timeout = 1000; + let type = event.success ? 'success' : 'danger'; + let timeout = 5000; if (event.important) { timeout = 0; @@ -84,7 +94,7 @@ export default { this.$notify({ message: event.message, timeout: timeout, - icon: "", + icon: "error_outline", type, }); @@ -102,39 +112,62 @@ export default { }); } - if(plus_data == 'type') { + if (plus_data == 'type') { Object.assign(data, { ['type']: 'normal', }); } + if (data.default_currency == 1) { + data.rate = 1; + } + + data.enabled = 1; + window.axios({ method: form_method, url: form_url, data: data, }) .then(response => { - if(form_list.length != undefined) { - if(form_method == 'POST') { + if (form_list.length != undefined) { + if (form_method == 'POST') { + if (data.default_currency == 1) { + form_list.forEach(item => { + item.default = 0; + item.default_currency = 0; + }); + } + form_list.push({ "id": response.data.data.id, "name": response.data.data.name, "code": response.data.data.code, "rate": response.data.data.rate, - "enabled": response.data.data.enabled != undefined ? response.data.data.enabled : 'true' + "enabled": response.data.data.enabled != undefined ? response.data.data.enabled : 'true', + "default": response.data.data.default ? response.data.data.default : 0, + "default_currency": response.data.data.default ? response.data.data.default : 0 }); } - if(form_method == 'PATCH') { + if (form_method == 'PATCH') { form_list.forEach(item => { + if (data.default_currency == 1) { + item.default = 0; + item.default_currency = 0; + } + if (item.id == form_id) { item.name = response.data.data.name; item.code = response.data.data.code; item.rate = response.data.data.rate; + item.default = response.data.data.default ? response.data.data.default : 0; + item.default_currency = response.data.data.default ? response.data.data.default : 0; } }); } } + this.onSuccessMessage(response); }, this) .catch(error => { @@ -145,20 +178,23 @@ export default { onEjetItem(event, form_list, event_id) { form_list.forEach(function (item, index) { if (item.id == event_id) { - form_list.splice(index, 1); - return; - } - }, this); + form_list.splice(index, 1); - this.component = ""; - document.body.classList.remove("overflow-hidden"); - this.onDeleteItemMessage(event); + return; + } + }, this); + + this.component = ""; + document.body.classList.remove("overflow-hidden"); + + this.onDeleteItemMessage(event); }, onFailErrorGet(field_name) { - if(this.error_field[field_name]) { + if (this.error_field[field_name]) { return this.error_field[field_name][0]; } + this.button_loading = false; }, diff --git a/resources/assets/js/views/common/documents.js b/resources/assets/js/views/common/documents.js index 366ff2bfd..26fe67ac2 100644 --- a/resources/assets/js/views/common/documents.js +++ b/resources/assets/js/views/common/documents.js @@ -589,8 +589,10 @@ const app = new Vue({ this.form.items[item_index][field_name] = this.items[item_index][field_name]; }, - async onPayment() { - let document_id = document.getElementById('document_id').value; + async onPayment(document_id) { + if (typeof document_id == 'object') { + document_id = document.getElementById('document_id').value; + } let payment = { modal: false, diff --git a/resources/assets/js/views/settings/currencies.js b/resources/assets/js/views/settings/currencies.js index a12b99393..52e2633ee 100644 --- a/resources/assets/js/views/settings/currencies.js +++ b/resources/assets/js/views/settings/currencies.js @@ -54,5 +54,13 @@ const app = new Vue({ .catch(error => { }); } + }, + + watch: { + 'form.default_currency': function (newVal, oldVal) { + if (newVal == 1) { + this.form.rate = 1; + } + }, } }); diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index d7d88b4a6..23995a026 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -119,271 +119,273 @@ - + diff --git a/resources/assets/js/views/wizard/Currencies.vue b/resources/assets/js/views/wizard/Currencies.vue index 63005fd4d..51f0618f9 100644 --- a/resources/assets/js/views/wizard/Currencies.vue +++ b/resources/assets/js/views/wizard/Currencies.vue @@ -9,7 +9,7 @@