Merge branch 'master' of https://github.com/brkcvn/akaunting into code-clean

This commit is contained in:
Burak Civan 2022-08-08 09:42:18 +03:00
commit cf5f65310e
13 changed files with 72 additions and 24 deletions

View File

@ -44,6 +44,26 @@ abstract class SettingController extends Controller
$total_companies = Company::count(); $total_companies = Company::count();
// Clear setting media
foreach ($this->file_keys as $file_key) {
$keys = explode('.', $file_key);
if ($prefix != $keys[0]) {
continue;
}
if (! setting($file_key, false)) {
continue;
}
$file_old_key = 'uploaded_' . $keys[1];
if (array_key_exists($file_old_key, $fields)) {
continue;
}
setting()->forget($file_key);
}
foreach ($fields as $key => $value) { foreach ($fields as $key => $value) {
$real_key = $prefix . '.' . $key; $real_key = $prefix . '.' . $key;

View File

@ -88,7 +88,7 @@ abstract class Index extends Component
public $classBulkAction; public $classBulkAction;
/** @var bool */ /** @var bool */
public $showPicture; public $showLogo;
/** @var bool */ /** @var bool */
public $hideName; public $hideName;
@ -179,7 +179,7 @@ abstract class Index extends Component
bool $hideEmptyPage = false, bool $hideSummary = false, $summaryItems = [], bool $hideSearchString = false, bool $hideBulkAction = false, bool $hideEmptyPage = false, bool $hideSummary = false, $summaryItems = [], bool $hideSearchString = false, bool $hideBulkAction = false,
string $searchStringModel = '', string $bulkActionClass = '', array $bulkActions = [], array $bulkActionRouteParameters = [], string $searchRoute = '', string $searchStringModel = '', string $bulkActionClass = '', array $bulkActions = [], array $bulkActionRouteParameters = [], string $searchRoute = '',
string $classBulkAction = '', string $classBulkAction = '',
bool $showPicture = false, bool $hideName = false, bool $hideTaxNumber = false, string $classNameAndTaxNumber = '', string $textName = '', string $textTaxNumber = '', bool $showLogo = false, bool $hideName = false, bool $hideTaxNumber = false, string $classNameAndTaxNumber = '', string $textName = '', string $textTaxNumber = '',
bool $hideEmail = false, bool $hidePhone = false, string $classEmailAndPhone = '', string $textEmail = '', string $textPhone = '', bool $hideEmail = false, bool $hidePhone = false, string $classEmailAndPhone = '', string $textEmail = '', string $textPhone = '',
bool $hideCountry = false, bool $hideCurrencyCode = false, string $classCountryAndCurrencyCode = '', string $textCountry = '', string $textCurrencyCode = '', bool $hideCountry = false, bool $hideCurrencyCode = false, string $classCountryAndCurrencyCode = '', string $textCountry = '', string $textCurrencyCode = '',
bool $hideOpen = false, bool $hideOverdue = false, string $classOpenAndOverdue = '', string $textOpen = '', string $textOverdue = '', bool $hideOpen = false, bool $hideOverdue = false, string $classOpenAndOverdue = '', string $textOpen = '', string $textOverdue = '',
@ -229,7 +229,7 @@ abstract class Index extends Component
$this->classBulkAction = $this->getClassBulkAction($type, $classBulkAction); $this->classBulkAction = $this->getClassBulkAction($type, $classBulkAction);
$this->showPicture = $showPicture; $this->showLogo = $showLogo;
$this->hideName = $hideName; $this->hideName = $hideName;
$this->hideTaxNumber = $hideTaxNumber; $this->hideTaxNumber = $hideTaxNumber;
$this->classNameAndTaxNumber = $this->getClassNameAndTaxNumber($type, $classNameAndTaxNumber); $this->classNameAndTaxNumber = $this->getClassNameAndTaxNumber($type, $classNameAndTaxNumber);

View File

@ -54,6 +54,22 @@ class Companies extends Controller
$file_keys = ['company.logo']; $file_keys = ['company.logo'];
$uploaded_file_keys = ['company.uploaded_logo']; $uploaded_file_keys = ['company.uploaded_logo'];
// Clear setting media
foreach ($file_keys as $file_key) {
$keys = explode('.', $file_key);
if (! setting($file_key, false)) {
continue;
}
$file_old_key = 'uploaded_' . $keys[1];
if (array_key_exists($file_old_key, $fields)) {
continue;
}
setting()->forget($file_key);
}
foreach ($fields as $key => $value) { foreach ($fields as $key => $value) {
// Don't process unwanted keys // Don't process unwanted keys
if (in_array($key, $skip_keys)) { if (in_array($key, $skip_keys)) {

View File

@ -28,6 +28,8 @@ class UpdateContact extends Job implements ShouldUpdate
$media = $this->getMedia($this->request->file('logo'), Str::plural($this->model->type)); $media = $this->getMedia($this->request->file('logo'), Str::plural($this->model->type));
$this->model->attachMedia($media, 'logo'); $this->model->attachMedia($media, 'logo');
} elseif (! $this->request->file('logo') && $this->model->logo) {
$this->deleteMediaModel($this->model, 'logo', $this->request);
} }
$this->model->update($this->request->all()); $this->model->update($this->request->all());

5
public/css/app.css vendored
View File

@ -47909,6 +47909,11 @@ body{
text-align: right; text-align: right;
} }
[dir="ltr"] .ltr\:text-xl{
font-size: 1.25rem;
line-height: 1.75rem;
}
[dir="rtl"] .rtl\:-left-1\.5{ [dir="rtl"] .rtl\:-left-1\.5{
left: -0.375rem; left: -0.375rem;
} }

View File

@ -17,6 +17,12 @@
<span class="material-icons-outlined avatar hidden" data-dz-thumbnail-word>content_paste</span> <span class="material-icons-outlined avatar hidden" data-dz-thumbnail-word>content_paste</span>
<span class="material-icons-outlined avatar hidden" data-dz-thumbnail-excel>table_chart</span> <span class="material-icons-outlined avatar hidden" data-dz-thumbnail-excel>table_chart</span>
<span class="mb-1 text-sm ml-3 text-gray-500 hidden" data-dz-name>...</span> <span class="mb-1 text-sm ml-3 text-gray-500 hidden" data-dz-name>...</span>
<div class="gap-x-1 relative">
<button data-dz-remove="true" class="absolute group right-0">
<span class="material-icons text-base text-red px-1.5 py-1 rounded-lg group-hover:bg-gray-100">delete</span>
</button>
</div>
</div> </div>
</div> </div>
@ -40,11 +46,11 @@
</div> </div>
<div class="gap-x-1"> <div class="gap-x-1">
<button data-dz-remove="true" class="btn btn-danger btn-sm"> <button data-dz-remove="true" class="group">
<span class="material-icons text-base text-red">delete</span> <span class="material-icons text-base text-red px-1.5 py-1 rounded-lg group-hover:bg-gray-100">delete</span>
</button> </button>
<a href="#" type="button" class="btn btn-sm btn-info hidden" data-dz-download> <a href="#" type="button" class="group hidden" data-dz-download>
<span class="material-icons-round text-base">download</span> <span class="material-icons-round text-base text-red px-1.5 py-1 rounded-lg group-hover:bg-gray-100">download</span>
</a> </a>
</div> </div>
</div> </div>

View File

@ -867,8 +867,7 @@ export default {
} }
html[dir='rtl'] .searh-field .el-tag-option { html[dir='rtl'] .searh-field .el-tag-option {
border-radius: 0.50rem; border-radius: 0 0.5rem 0.5rem 0;
margin-right: 10px;
} }
.searh-field .el-tag-operator { .searh-field .el-tag-operator {
@ -883,12 +882,12 @@ export default {
} }
html[dir='rtl'] .searh-field .el-tag-value { html[dir='rtl'] .searh-field .el-tag-value {
border-radius: 0.50rem; border-radius: 0.5rem 0 0 0.5rem;
margin-left: 10px; margin-left: 10px;
} }
html[dir='rtl'] .searh-field .el-tag-operator { html[dir='rtl'] .searh-field .el-tag-operator {
border-radius: 0.50rem; border-radius: 0;
} }
.searh-field .el-select.input-new-tag { .searh-field .el-select.input-new-tag {

View File

@ -64,7 +64,7 @@
@endif @endif
@if (! $hideLogo) @if (! $hideLogo)
<x-form.group.file name="logo" label="{{ trans_choice('general.pictures', 1) }}" not-required /> <x-form.group.file name="logo" label="{{ trans_choice('general.pictures', 1) }}" :value="! empty($contact) ? $contact->logo : false" not-required />
@endif @endif
</div> </div>
</x-slot> </x-slot>

View File

@ -136,15 +136,15 @@
@stack('name_td_start') @stack('name_td_start')
@if (! $hideName) @if (! $hideName)
<x-slot name="first" class="flex items-center"> <x-slot name="first" class="flex items-center">
@if ($showPicture) @if ($showLogo)
@if (is_object($item->picture)) @if (is_object($item->logo))
<img src="{{ Storage::url($item->picture->id) }}" class="absolute w-6 h-6 bottom-6 rounded-full mr-2 hidden lg:block" alt="{{ $item->name }}" title="{{ $item->name }}"> <img src="{{ Storage::url($item->logo->id) }}" class="absolute w-6 h-6 bottom-6 rounded-full mr-2 hidden lg:block" alt="{{ $item->name }}" title="{{ $item->name }}">
@else @else
<img src="{{ asset('public/img/user.svg') }}" class="absolute w-6 h-6 bottom-6 rounded-full mr-2 hidden lg:block" alt="{{ $item->name }}"/> <img src="{{ asset('public/img/user.svg') }}" class="absolute w-6 h-6 bottom-6 rounded-full mr-2 hidden lg:block" alt="{{ $item->name }}"/>
@endif @endif
@endif @endif
<div class="truncate {{ $showPicture ? ' ltr:pl-8 rtl:pr-8' : '' }}"> <div class="truncate {{ $showLogo ? ' ltr:pl-8 rtl:pr-8' : '' }}">
{{ $item->name }} {{ $item->name }}
</div> </div>
@ -157,7 +157,7 @@
@stack('tax_number_td_start') @stack('tax_number_td_start')
@if (! $hideTaxNumber) @if (! $hideTaxNumber)
<x-slot name="second" class="w-32 {{ $showPicture ? ' ltr:pl-8 rtl:pr-8' : '' }}"> <x-slot name="second" class="w-32 {{ $showLogo ? ' ltr:pl-8 rtl:pr-8' : '' }}">
{{ $item->tax_number }} {{ $item->tax_number }}
</x-slot> </x-slot>
@endif @endif

View File

@ -3,7 +3,7 @@
<div class="w-full lg:w-6/12 lg:ltr:pl-24 lg:rtl:pr-24"> <div class="w-full lg:w-6/12 lg:ltr:pl-24 lg:rtl:pr-24">
<div class="relative mb-10" x-data="{ toggle: 'donut' }"> <div class="relative mb-10" x-data="{ toggle: 'donut' }">
<div class="flex border-b pb-2"> <div class="flex border-b pb-2">
<div class="w-full lg:w-11/12 text-xl text-left text-black-400"> <div class="w-full lg:w-11/12 ltr:text-xl rtl:text-right text-left text-black-400">
<h2 x-show="toggle === 'donut'">{{ trans('general.timeline') }}</h2> <h2 x-show="toggle === 'donut'">{{ trans('general.timeline') }}</h2>
<h2 x-show="toggle === 'bar'">{{ trans('general.distribution') }}</h2> <h2 x-show="toggle === 'bar'">{{ trans('general.distribution') }}</h2>
</div> </div>

View File

@ -16,7 +16,7 @@
</x-slot> </x-slot>
<x-slot name="content"> <x-slot name="content">
<x-contacts.index.content type="vendor" :contacts="$vendors" show-picture /> <x-contacts.index.content type="vendor" :contacts="$vendors" show-logo />
</x-slot> </x-slot>
<x-contacts.script type="vendor" /> <x-contacts.script type="vendor" />