diff --git a/app/BulkActions/Settings/Categories.php b/app/BulkActions/Settings/Categories.php index ed63dd003..77afe39c0 100644 --- a/app/BulkActions/Settings/Categories.php +++ b/app/BulkActions/Settings/Categories.php @@ -39,6 +39,19 @@ class Categories extends BulkAction ], ]; + public function getSelectedRecords($request, $relationships = null) + { + if (empty($relationships)) { + $model = $this->model::query(); + } else { + $relationships = Arr::wrap($relationships); + + $model = $this->model::with($relationships); + } + + return $model->getWithoutChildren()->find($this->getSelectedInput($request)); + } + public function disable($request) { $categories = $this->getSelectedRecords($request); diff --git a/app/Http/Controllers/Modules/Item.php b/app/Http/Controllers/Modules/Item.php index 6f279a1c7..096ed6771 100644 --- a/app/Http/Controllers/Modules/Item.php +++ b/app/Http/Controllers/Modules/Item.php @@ -276,10 +276,10 @@ class Item extends Controller public function uninstall($alias) { try { - $this->dispatch(new UninstallModule($alias, company_id())); - $name = module($alias)->getName(); + $this->dispatch(new UninstallModule($alias, company_id())); + $message = trans('modules.uninstalled', ['module' => $name]); flash($message)->success(); @@ -295,10 +295,10 @@ class Item extends Controller public function enable($alias) { try { - $this->dispatch(new EnableModule($alias, company_id())); - $name = module($alias)->getName(); + $this->dispatch(new EnableModule($alias, company_id())); + $message = trans('modules.enabled', ['module' => $name]); flash($message)->success(); @@ -314,10 +314,10 @@ class Item extends Controller public function disable($alias) { try { - $this->dispatch(new DisableModule($alias, company_id())); - $name = module($alias)->getName(); + $this->dispatch(new DisableModule($alias, company_id())); + $message = trans('modules.disabled', ['module' => $name]); flash($message)->success(); diff --git a/app/Http/Livewire/Menu/Notifications.php b/app/Http/Livewire/Menu/Notifications.php index 6b11c30dc..12b1df15b 100644 --- a/app/Http/Livewire/Menu/Notifications.php +++ b/app/Http/Livewire/Menu/Notifications.php @@ -91,7 +91,7 @@ class Notifications extends Component public function getNotifications(): array { $notifications = new \stdClass(); - $notifications->notifications = []; + $notifications->notifications = collect(); $notifications->keyword = $this->keyword; event(new NotificationsCreated($notifications)); diff --git a/app/Listeners/Menu/ShowInNotifications.php b/app/Listeners/Menu/ShowInNotifications.php index 6ba776b82..c73da1ecc 100644 --- a/app/Listeners/Menu/ShowInNotifications.php +++ b/app/Listeners/Menu/ShowInNotifications.php @@ -59,6 +59,13 @@ class ShowInNotifications continue; } + $app_url = route('apps.app.show', [ + 'alias' => $new_app->alias, + 'utm_source' => 'notification', + 'utm_medium' => 'software', + 'utm_campaign' => str_replace('-', '', $new_app->alias), + ]); + $new = new DatabaseNotification(); $new->id = $key; $new->type = 'new-apps'; @@ -66,7 +73,7 @@ class ShowInNotifications $new->notifiable_id = user()->id; $new->data = [ 'title' => $new_app->name, - 'description' => '', // $new_app->message, + 'description' => trans('notifications.new_apps', ['app' => $new_app->name, 'url' => $app_url]), 'alias' => $new_app->alias, ]; $new->created_at = $new_app->started_at->date; diff --git a/app/Listeners/Update/V30/Version303.php b/app/Listeners/Update/V30/Version303.php new file mode 100644 index 000000000..a2edb582f --- /dev/null +++ b/app/Listeners/Update/V30/Version303.php @@ -0,0 +1,107 @@ +skipThisUpdate($event)) { + return; + } + + Log::channel('stderr')->info('Starting the Akaunting 3.0.3 update...'); + + $this->updateCompanies(); + + Log::channel('stderr')->info('Akaunting 3.0.3 update finished.'); + } + + public function updateCompanies() + { + Log::channel('stderr')->info('Updating companies...'); + + $company_id = company_id(); + + $companies = Company::cursor(); + + foreach ($companies as $company) { + Log::channel('stderr')->info('Updating company:' . $company->id); + + $company->makeCurrent(); + + $this->updateWidgets(); + + Log::channel('stderr')->info('Company updated:' . $company->id); + } + + company($company_id)->makeCurrent(); + + Log::channel('stderr')->info('Companies updated.'); + } + + public function updateWidgets() + { + Log::channel('stderr')->info('Updating widgets...'); + + $widgets = Widget::cursor(); + + foreach ($widgets as $widget) { + Log::channel('stderr')->info('Updating widget:' . $widget->id); + + $widget_settings = $widget->settings; + + if (empty($widget_settings->width)) { + Log::channel('stderr')->info('Skip widget:' . $widget->id); + + continue; + } + + if (Str::contains($widget_settings->width, 'w-full')) { + Log::channel('stderr')->info('Already new classs widget:' . $widget->id); + + continue; + } + + switch ($widget_settings->width) { + case 'col-md-3': + $widget_settings->width = 'w-full lg:w-1/4 px-6'; + break; + case 'col-md-4': + $widget_settings->width = 'w-full lg:w-1/3 px-6'; + break; + case 'col-md-6': + $widget_settings->width = 'w-full lg:w-2/4 px-12'; + break; + case 'col-md-12': + $widget_settings->width = 'w-full px-12'; + break; + } + + $widget->settings = $widget_settings; + + $widget->save(); + + Log::channel('stderr')->info('Widget updated:' . $widget->id); + } + + Log::channel('stderr')->info('Widgets updated.'); + } +} diff --git a/app/Models/Common/Item.php b/app/Models/Common/Item.php index 2599e5e33..77091aac6 100644 --- a/app/Models/Common/Item.php +++ b/app/Models/Common/Item.php @@ -4,6 +4,7 @@ namespace App\Models\Common; use App\Abstracts\Model; use App\Models\Document\Document; +use App\Utilities\Str; use App\Traits\Currencies; use App\Traits\Media; use Bkwld\Cloner\Cloneable; @@ -138,6 +139,11 @@ class Item extends Model ->select('items.*'); } + public function getInitialsAttribute($value) + { + return Str::getInitials($this->name); + } + /** * Get the current balance. * diff --git a/app/Providers/Event.php b/app/Providers/Event.php index 832bae905..0e9351031 100644 --- a/app/Providers/Event.php +++ b/app/Providers/Event.php @@ -16,6 +16,7 @@ class Event extends Provider 'App\Listeners\Update\CreateModuleUpdatedHistory', 'App\Listeners\Module\UpdateExtraModules', 'App\Listeners\Update\V30\Version300', + 'App\Listeners\Update\V30\Version303', ], 'Illuminate\Auth\Events\Login' => [ 'App\Listeners\Auth\Login', diff --git a/app/View/Components/Layouts/Admin/Menu.php b/app/View/Components/Layouts/Admin/Menu.php index ff4a91b49..97c4ba382 100644 --- a/app/View/Components/Layouts/Admin/Menu.php +++ b/app/View/Components/Layouts/Admin/Menu.php @@ -41,7 +41,7 @@ class Menu extends Component { // Get nofitications $notifications = new \stdClass(); - $notifications->notifications = []; + $notifications->notifications = collect(); $notifications->keyword = ''; event(new NotificationsCreated($notifications)); diff --git a/resources/assets/js/components/AkauntingSearch.vue b/resources/assets/js/components/AkauntingSearch.vue index 2c27fe295..3cd583b70 100644 --- a/resources/assets/js/components/AkauntingSearch.vue +++ b/resources/assets/js/components/AkauntingSearch.vue @@ -385,12 +385,11 @@ export default { }, onOptionSelected(value) { - this.show_icon = false; this.current_value = value; this.range = false; - - this.dynamicPlaceholder = this.selectPlaceholder; + this.onChangeSearchAndFilterText(this.selectPlaceholder, false); + let option = false; let option_url = false; @@ -522,7 +521,7 @@ export default { this.show_close_icon = true; let select_value = false; - this.dynamicPlaceholder = this.enterPlaceholder; + this.onChangeSearchAndFilterText(this.enterPlaceholder, false); for (let i = 0; i < this.values.length; i++) { if (this.values[i].key == value) { @@ -582,7 +581,9 @@ export default { this.show_date = false; if (this.filter_index == 0) { - this.dynamicPlaceholder = this.defaultPlaceholder; + this.onChangeSearchAndFilterText(this.defaultPlaceholder, true); + } else { + this.show_icon = false; } this.filter_last_step = 'options'; @@ -597,6 +598,11 @@ export default { this.onInputConfirm(); }, + onChangeSearchAndFilterText(arg, param) { + this.dynamicPlaceholder = arg; + this.show_icon = param; + }, + convertOption(options) { let values = []; @@ -765,6 +771,9 @@ export default { }, mounted() { + if (this.filter_index > 0) { + this.onChangeSearchAndFilterText(this.enterPlaceholder, false); + } }, computed: { diff --git a/resources/assets/js/components/CreditCard/CardForm.vue b/resources/assets/js/components/CreditCard/CardForm.vue index c3779ae93..dbcfb19fb 100644 --- a/resources/assets/js/components/CreditCard/CardForm.vue +++ b/resources/assets/js/components/CreditCard/CardForm.vue @@ -260,7 +260,7 @@ v-for="n in 12" v-bind:disabled="n < minCardMonth" v-bind:key="n" - >{{generateMonthValue(n)}} + >{{ generateMonthValue(n) }} @@ -278,7 +278,7 @@ v-bind:value="$index + minCardYear" v-for="(n, $index) in 12" v-bind:key="n" - >{{$index + minCardYear}} + >{{ $index + minCardYear }} @@ -312,7 +312,7 @@ - @@ -26,15 +26,18 @@
{!! $notification->data['title'] !!} - {{ \Carbon\Carbon::createFromTimeStamp(strtotime($notification->created_at))->diffForHumans() }} + + + {{ \Carbon\Carbon::createFromTimeStamp(strtotime($notification->created_at))->diffForHumans() }} +
@if ($notification->type != 'updates') - - - + + + @endif
diff --git a/resources/views/portal/invoices/show.blade.php b/resources/views/portal/invoices/show.blade.php index 0c554bd8e..27e738642 100644 --- a/resources/views/portal/invoices/show.blade.php +++ b/resources/views/portal/invoices/show.blade.php @@ -24,33 +24,37 @@
@php $is_active = true; @endphp - +
+ @php $is_active = true; @endphp @foreach ($payment_methods as $key => $name) @stack('invoice_{{ $key }}_content_start') +
+ @stack('invoice_{{ $key }}_content_end') @php $is_active = false; @endphp diff --git a/resources/views/settings/categories/index.blade.php b/resources/views/settings/categories/index.blade.php index 614e466bf..b280bd9e1 100644 --- a/resources/views/settings/categories/index.blade.php +++ b/resources/views/settings/categories/index.blade.php @@ -64,51 +64,58 @@ - @foreach($categories as $category) - + @foreach($categories as $item) + - @if ($category->sub_categories->count()) + @if ($item->sub_categories->count())
- {{ $category->name }} - + {{ $item->name }} + +
@else - {{ $category->name }} + + {{ $item->name }} + + @endif + + @if (! $item->enabled) + @endif
- @if (! empty($types[$category->type])) - {{ $types[$category->type] }} + @if (! empty($types[$item->type])) + {{ $types[$item->type] }} @else @endif - circle + circle - +
- @foreach($category->sub_categories as $sub_category) - @include('settings.categories.sub_category', ['parent_category' => $category, 'sub_category' => $sub_category, 'tree_level' => 1]) + @foreach($item->sub_categories as $sub_category) + @include('settings.categories.sub_category', ['parent_category' => $item, 'sub_category' => $sub_category, 'tree_level' => 1]) @endforeach @endforeach
diff --git a/resources/views/settings/categories/sub_category.blade.php b/resources/views/settings/categories/sub_category.blade.php index be9afa002..4523c724e 100644 --- a/resources/views/settings/categories/sub_category.blade.php +++ b/resources/views/settings/categories/sub_category.blade.php @@ -28,18 +28,22 @@ {{ $sub_category->name }}
@endif + + @if (! $sub_category->enabled) + + @endif - @if (! empty($types[$category->type])) - {{ $types[$category->type] }} + @if (! empty($types[$item->type])) + {{ $types[$item->type] }} @else @endif - circle + circle diff --git a/resources/views/widgets/account_balance.blade.php b/resources/views/widgets/account_balance.blade.php index 7a5d3ad76..2f5e5ea02 100644 --- a/resources/views/widgets/account_balance.blade.php +++ b/resources/views/widgets/account_balance.blade.php @@ -4,8 +4,11 @@
    @foreach($accounts as $item)
  • - {{ $item->name }} - {{ $item->balance_formatted }} + {{ $item->title }} + + + {{ $item->balance_formatted }} +
  • @endforeach
diff --git a/resources/views/widgets/cash_flow.blade.php b/resources/views/widgets/cash_flow.blade.php index 2150cd559..2c392ec6e 100644 --- a/resources/views/widgets/cash_flow.blade.php +++ b/resources/views/widgets/cash_flow.blade.php @@ -12,7 +12,9 @@ {{ $totals['incoming'] }} - {{ trans('general.incoming') }} + + {{ trans('general.incoming') }} + remove @@ -22,7 +24,9 @@ {{ $totals['outgoing'] }} - {{ trans('general.outgoing') }} + + {{ trans('general.outgoing') }} + drag_handle diff --git a/resources/views/widgets/currencies.blade.php b/resources/views/widgets/currencies.blade.php index f787b6e6c..301850ad9 100644 --- a/resources/views/widgets/currencies.blade.php +++ b/resources/views/widgets/currencies.blade.php @@ -5,7 +5,10 @@ @foreach($currencies as $item)
  • {{ $item->name }} - {{ $item->rate }} + + + {{ $item->rate }} +
  • @endforeach diff --git a/resources/views/widgets/receivables_payables.blade.php b/resources/views/widgets/receivables_payables.blade.php index e55d3d06d..a1cbbd78c 100644 --- a/resources/views/widgets/receivables_payables.blade.php +++ b/resources/views/widgets/receivables_payables.blade.php @@ -28,17 +28,24 @@