Merge branch 'master' of https://github.com/brkcvn/akaunting into form-elements

This commit is contained in:
Burak Civan 2022-06-24 10:03:19 +03:00
commit d4d48855a8
27 changed files with 300 additions and 92 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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));

View File

@ -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;

View File

@ -0,0 +1,107 @@
<?php
namespace App\Listeners\Update\V30;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Models\Common\Widget;
use App\Models\Common\Company;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class Version303 extends Listener
{
const ALIAS = 'core';
const VERSION = '3.0.3';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(Event $event)
{
if ($this->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.');
}
}

View File

@ -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.
*

View File

@ -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',

View File

@ -41,7 +41,7 @@ class Menu extends Component
{
// Get nofitications
$notifications = new \stdClass();
$notifications->notifications = [];
$notifications->notifications = collect();
$notifications->keyword = '';
event(new NotificationsCreated($notifications));

View File

@ -385,11 +385,10 @@ 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: {

View File

@ -260,7 +260,7 @@
v-for="n in 12"
v-bind:disabled="n < minCardMonth"
v-bind:key="n"
>{{generateMonthValue(n)}}</option>
>{{ generateMonthValue(n) }}</option>
</select>
</div>
</div>
@ -278,7 +278,7 @@
v-bind:value="$index + minCardYear"
v-for="(n, $index) in 12"
v-bind:key="n"
>{{$index + minCardYear}}</option>
>{{ $index + minCardYear }}</option>
</select>
</div>
@ -312,7 +312,7 @@
</label>
</div>
<button class="relative flex items-center justify-center px-6 py-1.5 bg-green hover:bg-green-700 text-white rounded-lg" v-on:click="invaildCard" :disabled="loading">
<button v-if="! hideButton" class="relative flex items-center justify-center px-6 py-1.5 bg-green hover:bg-green-700 text-white rounded-lg" v-on:click="invaildCard" :disabled="loading">
<i
v-if="loading"
class="animate-submit delay-[0.28s] absolute w-2 h-2 rounded-full left-0 right-0 -top-3.5 m-auto before:absolute before:w-2 before:h-2 before:rounded-full before:animate-submit before:delay-[0.14s] after:absolute after:w-2 after:h-2 after:rounded-full after:animate-submit before:-left-3.5 after:-right-3.5 after:delay-[0.42s]"
@ -371,7 +371,9 @@ export default {
props: {
cards: {
type: [Array, Object],
default: [],
default: function () {
return [];
},
description: "Add Card Style"
},
@ -454,6 +456,12 @@ export default {
description: "Placeholder Card CVV Text"
},
hideButton: {
type: Boolean,
default: false,
description: "Confirm button"
},
textButton: {
type: String,
default: 'Confirm',
@ -554,7 +562,6 @@ export default {
this.register_card = null;
},
onSelectedCard(card_id) {
this.card_id = card_id;
this.formData.card_id = card_id;
@ -623,7 +630,8 @@ export default {
this.unMaskCardNumber();
/*for (let i = number.length - 1; i >= 0; i--) {
/*
for (let i = number.length - 1; i >= 0; i--) {
let num = number.charAt(i);
if (isOdd) {
@ -639,7 +647,8 @@ export default {
}
isOdd = !isOdd;
}*/
}
*/
this.formData.card_id = this.card_id;

View File

@ -24,6 +24,7 @@ import AkauntingConnectTransactions from './../components/AkauntingConnectTransa
import AkauntingSwitch from './../components/AkauntingSwitch';
import AkauntingSlider from './../components/AkauntingSlider';
import AkauntingColor from './../components/AkauntingColor';
import CardForm from './../components/CreditCard/CardForm';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
@ -61,6 +62,7 @@ export default {
AkauntingSwitch,
AkauntingSlider,
AkauntingColor,
CardForm,
[Select.name]: Select,
[Option.name]: Option,
[Steps.name]: Steps,
@ -91,6 +93,16 @@ export default {
currency: {},
documents: [],
},
cardData: {
cardName: '',
cardNumber: '',
cardMonth: '',
cardYear: '',
cardCvv: '',
storeCard: false,
card_id: 0,
},
}
},

View File

@ -6,9 +6,10 @@ return [
'hello' => 'Hello!',
'salutation' => 'Regards,<br> :company_name',
'subcopy' => 'If youre having trouble clicking the ":text" button, copy and paste the URL below into your web browser: [:url](:url)',
'mark_read' => 'Mark Read',
'mark_read_all' => 'Mark Read All',
'mark_read' => 'Mark as Read',
'mark_read_all' => 'Mark as All Read',
'empty' => 'Woohoo, notification zero!',
'new_apps' => ':app is available. <a href=":url">Check it out now</a>!',
'update' => [

View File

@ -15,7 +15,7 @@ return [
'general' => 'Here you can enter the general information of transaction such as date, amount, account, description, etc.',
'assign_income' => 'Select a category and customer to make your reports more detailed.',
'assign_expense' => 'Select a category and vendor to make your reports more detailed.',
'other' => 'Enter a reference to keep the transaction linked to your records.',
'other' => 'Enter a number and reference to keep the transaction linked to your records.',
],
'slider' => [

View File

@ -77,7 +77,7 @@
@stack('remove_th_start')
<th class="border-t-0 border-r-0 border-b-0" style="vertical-align:bottom;">
<th class="border-t-0 border-r-0 border-b-0 align-bottom" style="width:24px; display:block;">
<div></div>
</th>

View File

@ -12,7 +12,7 @@
textButton="{{ trans('general.confirm') }}"
textCard="{{ trans_choice('general.card.cards', 2) }}"
textNewCard="{{ trans('general.form.add_new', ['field' => trans_choice('general.card.cards', 1)]) }}"
textStoreCard="{{ trans('general.card.save') }} "
textStoreCard="{{ trans('general.card.save') }}"
:store-card="{{ !empty($store_card) ? 'true' : 'false' }}"
:cards="{{ !empty($cards) ? json_encode($cards) : json_encode([]) }}"
:form-data="formData"

View File

@ -8,6 +8,7 @@
data-id="tab-{{ $id }}"
data-tabs="{{ $id }}"
x-bind:class="active != '{{ $id }}' ? '' : 'active-tabs text-purple border-purple transition-all after:absolute after:w-full after:h-0.5 after:left-0 after:right-0 after:bottom-0 after:bg-purple after:rounded-tl-md after:rounded-tr-md'"
{{ $attributes }}
>
@if ($slot->isNotEmpty())
{!! $slot !!}

View File

@ -9,6 +9,7 @@
data-tabs="{{ $id }}"
x-on:click="active = '{{ $id }}'"
x-bind:class="active != '{{ $id }}' ? '' : 'active-tabs text-purple border-purple transition-all after:absolute after:w-full after:h-0.5 after:left-0 after:right-0 after:bottom-0 after:bg-purple after:rounded-tl-md after:rounded-tr-md'"
{{ $attributes }}
>
@if ($slot->isNotEmpty())
{!! $slot !!}

View File

@ -1,5 +1,10 @@
@props(['id'])
<div id="tab-{{ $id }}" data-tabs-content="{{ $id }}" x-show="active === '{{ $id }}'">
<div
id="tab-{{ $id }}"
data-tabs-content="{{ $id }}"
x-show="active === '{{ $id }}'"
{{ $attributes }}
>
{{ $slot }}
</div>

View File

@ -9,7 +9,7 @@
@if ($notifications)
<div class="flex justify-end mt-1 mb-3">
<x-tooltip id="notification-all" placement="top" message="Mark as All Read">
<x-tooltip id="notification-all" placement="top" message="{{ trans('notifications.mark_read_all') }}">
<button type="button" wire:click="markReadAll()">
<span id="menu-notification-read-all" class="material-icons text-lg text-purple">done_all</span>
</button>
@ -26,11 +26,14 @@
<div class="flex items-start justify-between font-medium text-sm text-purple mb-1">
<div class="flex flex-col">
{!! $notification->data['title'] !!}
<span class="text-gray-500" style="font-size: 10px;">{{ \Carbon\Carbon::createFromTimeStamp(strtotime($notification->created_at))->diffForHumans() }}</span>
<span class="text-gray-500" style="font-size: 10px;">
{{ \Carbon\Carbon::createFromTimeStamp(strtotime($notification->created_at))->diffForHumans() }}
</span>
</div>
@if ($notification->type != 'updates')
<x-tooltip id="notification-{{ $notification->id }}" placement="top" message="Clear Notification">
<x-tooltip id="notification-{{ $notification->id }}" placement="top" message="{{ trans('notifications.mark_read') }}">
<button type="button" wire:click="markRead('{{ $notification->type }}', '{{ $notification->id }}')">
<span id="menu-notification-mark-read" class="material-icons text-lg text-purple">check_circle_outline</span>
</button>

View File

@ -29,6 +29,7 @@
<div class="swiper-wrapper">
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_tab_start')
<div class="swiper-slide">
<div
x-on:click="active = '{{ $name }}'"
@ -40,6 +41,7 @@
{{ $name }}
</div>
</div>
@stack('invoice_{{ $key }}_tab_end')
@php $is_active = false; @endphp
@ -47,10 +49,12 @@
</div>
</div>
</div>
@php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_content_start')
<div
x-bind:class="active != '{{ $name }}' ? 'hidden': 'block'"
class="my-3"
@ -58,6 +62,7 @@
>
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
@stack('invoice_{{ $key }}_content_end')
@php $is_active = false; @endphp

View File

@ -64,51 +64,58 @@
</x-table.thead>
<x-table.tbody>
@foreach($categories as $category)
<x-table.tr href="{{ route('categories.edit', $category->id) }}" class="relative flex items-center border-b hover:bg-gray-100 px-1 group transition-all">
@foreach($categories as $item)
<x-table.tr href="{{ route('categories.edit', $item->id) }}" class="relative flex items-center border-b hover:bg-gray-100 px-1 group transition-all">
<x-table.td class="ltr:pr-6 rtl:pl-6 hidden sm:table-cell" override="class">
<x-index.bulkaction.single id="{{ $category->id }}" name="{{ $category->name }}" />
<x-index.bulkaction.single id="{{ $item->id }}" name="{{ $item->name }}" />
</x-table.td>
<x-table.td class="w-5/12 truncate">
@if ($category->sub_categories->count())
@if ($item->sub_categories->count())
<div class="flex items-center font-bold">
{{ $category->name }}
<x-tooltip id="tooltip-category-{{ $category->id }}" placement="bottom" message="{{ trans('categories.collapse') }}">
{{ $item->name }}
<x-tooltip id="tooltip-category-{{ $item->id }}" placement="bottom" message="{{ trans('categories.collapse') }}">
<button
type="button"
class="w-4 h-4 flex items-center justify-center mx-2 leading-none align-text-top rounded-lg bg-gray-500 hover:bg-gray-700"
node="child-{{ $category->id }}"
onClick="toggleSub('child-{{ $category->id }}', event)"
node="child-{{ $item->id }}"
onClick="toggleSub('child-{{ $item->id }}', event)"
>
<span class="material-icons transform rotate-90 transition-all text-lg leading-none align-middle text-white">chevron_right</span>
</button>
</x-tooltip>
</div>
@else
<span class="font-bold">{{ $category->name }}</span>
<span class="font-bold">
{{ $item->name }}
</span>
@endif
@if (! $item->enabled)
<x-index.disable text="{{ trans_choice('general.categories', 1) }}" />
@endif
</x-table.td>
<x-table.td class="w-5/12 truncate">
@if (! empty($types[$category->type]))
{{ $types[$category->type] }}
@if (! empty($types[$item->type]))
{{ $types[$item->type] }}
@else
<x-empty-data />
@endif
</x-table.td>
<x-table.td class="w-2/12 relative">
<span class="material-icons text-{{ $category->color }}" class="text-3xl" style="color:{{ $category->color }};">circle</span>
<span class="material-icons text-{{ $item->color }}" class="text-3xl" style="color:{{ $item->color }};">circle</span>
</x-table.td>
<x-table.td kind="action">
<x-table.actions :model="$category" />
<x-table.actions :model="$item" />
</x-table.td>
</x-table.tr>
@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
</x-table.tbody>

View File

@ -28,18 +28,22 @@
{{ $sub_category->name }}
</div>
@endif
@if (! $sub_category->enabled)
<x-index.disable text="{{ trans_choice('general.categories', 1) }}" />
@endif
</x-table.td>
<x-table.td class="w-5/12 ltr:pr-6 rtl:pl-6 py-4 ltr:text-left rtl:text-right whitespace-nowrap text-sm font-normal text-black cursor-pointer truncate">
@if (! empty($types[$category->type]))
{{ $types[$category->type] }}
@if (! empty($types[$item->type]))
{{ $types[$item->type] }}
@else
<x-empty-data />
@endif
</x-table.td>
<x-table.td class="ltr:pr-6 rtl:pl-6 py-4 ltr:text-left rtl:text-right whitespace-nowrap text-sm font-normal text-black cursor-pointer w-2/12 relative">
<span class="material-icons text-3xl text-{{ $category->color }}" style="color:{{ $sub_category->color }};">circle</span>
<span class="material-icons text-3xl text-{{ $item->color }}" style="color:{{ $sub_category->color }};">circle</span>
</x-table.td>
<x-table.td kind="action">

View File

@ -4,8 +4,11 @@
<ul class="text-sm space-y-3 my-3">
@foreach($accounts as $item)
<li class="flex justify-between">
{{ $item->name }}
<span class="font-medium">{{ $item->balance_formatted }}</span>
{{ $item->title }}
<span class="font-medium">
{{ $item->balance_formatted }}
</span>
</li>
@endforeach
</ul>

View File

@ -12,7 +12,9 @@
{{ $totals['incoming'] }}
</div>
<span class="text-green text-xs">{{ trans('general.incoming') }}</span>
<span class="text-green text-xs">
{{ trans('general.incoming') }}
</span>
<span class="material-icons mt-2">remove</span>
</div>
@ -22,7 +24,9 @@
{{ $totals['outgoing'] }}
</div>
<span class="text-rose text-xs">{{ trans('general.outgoing') }}</span>
<span class="text-rose text-xs">
{{ trans('general.outgoing') }}
</span>
<span class="material-icons mt-2">drag_handle</span>
</div>

View File

@ -5,7 +5,10 @@
@foreach($currencies as $item)
<li class="flex justify-between">
{{ $item->name }}
<span class="font-medium">{{ $item->rate }}</span>
<span class="font-medium">
{{ $item->rate }}
</span>
</li>
@endforeach
</ul>

View File

@ -28,17 +28,24 @@
</span>
<button id="dashboard-widget-{{ strtolower(class_basename($class)) }}-overdue" type="button" class="flex items-center text-black-400 font-medium group" data-dropdown-toggle="widgets-list-{{ $class->model->id }}">
<span class="border-b border-transparent transition-all group-hover:border-black-400"> {{ $totals['overdue'] }} </span>
<span class="border-b border-transparent transition-all group-hover:border-black-400">
{{ $totals['overdue'] }}
</span>
<div class="relative flex">
<span class="material-icons-round cursor-pointer">arrow_drop_down</span>
<div id="widgets-list-{{ $class->model->id }}" class="absolute right-0 mt-3 py-2 bg-white rounded-md border border-gray-200 shadow-xl z-20 hidden" style="left: auto; min-width: 10rem;">
@foreach($periods as $name => $amount)
@foreach ($periods as $name => $amount)
<div id="dashboard-widget-{{ strtolower(class_basename($class)) }}-{{ str_replace('_', '-', $name) }}" class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap cursor-auto">
<div class="w-full h-full flex items-center justify-between rounded-md px-2 text-sm hover:bg-lilac-100">
<div class="font-normal text-sm">{{ trans('widgets.periods.' . $name) }}</div>
<div class="pl-12 text-sm">{{ $amount }}</div>
<div class="font-normal text-sm">
{{ trans('widgets.periods.' . $name) }}
</div>
<div class="pl-12 text-sm">
{{ $amount }}
</div>
</div>
</div>
@endforeach