From 040527734dedefb90b110a94a5d07dae4e788bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 26 Jul 2022 15:56:43 +0300 Subject: [PATCH 1/4] close #2552 Added: Quick category modal add parent category field --- app/Http/Controllers/Modals/Categories.php | 21 +++++++++++++--- .../js/components/AkauntingModalAddNew.vue | 24 +++++++++++++++++++ .../components/form/group/select.blade.php | 4 ++++ .../views/modals/categories/create.blade.php | 6 ++++- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Modals/Categories.php b/app/Http/Controllers/Modals/Categories.php index fa4559fb2..11a422bfa 100644 --- a/app/Http/Controllers/Modals/Categories.php +++ b/app/Http/Controllers/Modals/Categories.php @@ -3,9 +3,10 @@ namespace App\Http\Controllers\Modals; use App\Abstracts\Http\Controller; -use App\Jobs\Setting\CreateCategory; -use Illuminate\Http\Request as IRequest; use App\Http\Requests\Setting\Category as Request; +use App\Jobs\Setting\CreateCategory; +use App\Models\Setting\Category; +use Illuminate\Http\Request as IRequest; class Categories extends Controller { @@ -30,7 +31,21 @@ class Categories extends Controller { $type = $request->get('type', 'item'); - $html = view('modals.categories.create', compact('type'))->render(); + $categories = []; + + foreach (config('type.category') as $type => $config) { + $categories[$type] = []; + } + + Category::enabled()->orderBy('name')->get()->each(function ($category) use (&$categories) { + $categories[$category->type][] = [ + 'id' => $category->id, + 'title' => $category->name, + 'level' => $category->level, + ]; + }); + + $html = view('modals.categories.create', compact('type', 'categories'))->render(); return response()->json([ 'success' => true, diff --git a/resources/assets/js/components/AkauntingModalAddNew.vue b/resources/assets/js/components/AkauntingModalAddNew.vue index 1846ca549..7225d8481 100644 --- a/resources/assets/js/components/AkauntingModalAddNew.vue +++ b/resources/assets/js/components/AkauntingModalAddNew.vue @@ -228,6 +228,8 @@ export default { '#efef32' ], min_date: false, + categoriesBasedTypes: null, + isParentCategoryDisabled: true, } }, @@ -288,6 +290,28 @@ export default { .catch(error => { }); }, + + updateParentCategories(event) { + if (event === '') { + return; + } + + if (typeof JSON.parse(this.form.categories)[event] === 'undefined') { + this.categoriesBasedTypes = []; + this.isParentCategoryDisabled = true; + + return; + } + + if (this.form.parent_category_id) { + this.form.parent_category_id = null; + + return; + } + + this.categoriesBasedTypes = JSON.parse(this.form.categories)[event]; + this.isParentCategoryDisabled = false; + }, } }) }); diff --git a/resources/views/components/form/group/select.blade.php b/resources/views/components/form/group/select.blade.php index c157a4c22..ff2c421ed 100644 --- a/resources/views/components/form/group/select.blade.php +++ b/resources/views/components/form/group/select.blade.php @@ -125,6 +125,10 @@ @change="{{ $attributes['change'] }}($event)" @endif + @if (! empty($attributes['focus'])) + @focus="{{ $attributes['focus'] }}" + @endif + @if (! empty($attributes['visible-change'])) @visible-change="{{ $attributes['visible-change'] }}" @endif diff --git a/resources/views/modals/categories/create.blade.php b/resources/views/modals/categories/create.blade.php index 1dd29da55..bf57ce287 100644 --- a/resources/views/modals/categories/create.blade.php +++ b/resources/views/modals/categories/create.blade.php @@ -4,7 +4,11 @@ - + + + + + From 60b4fcd212da7a001182ef11d5a7a5f99da38026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 26 Jul 2022 17:40:25 +0300 Subject: [PATCH 2/4] updated lang files --- resources/lang/en-GB/passwords.php | 1 - resources/lang/en-GB/validation.php | 74 +++++++++++++++++------------ 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/resources/lang/en-GB/passwords.php b/resources/lang/en-GB/passwords.php index 363960360..2345a56b5 100644 --- a/resources/lang/en-GB/passwords.php +++ b/resources/lang/en-GB/passwords.php @@ -13,7 +13,6 @@ return [ | */ - 'password' => 'Passwords must be at least six characters and match the confirmation.', 'reset' => 'Your password has been reset!', 'sent' => 'We have emailed your password reset link!', 'throttled' => 'Please wait before retrying.', diff --git a/resources/lang/en-GB/validation.php b/resources/lang/en-GB/validation.php index 80ca77535..1f15c2df7 100644 --- a/resources/lang/en-GB/validation.php +++ b/resources/lang/en-GB/validation.php @@ -14,6 +14,7 @@ return [ */ 'accepted' => 'The :attribute must be accepted.', + 'accepted_if' => 'The :attribute must be accepted when :other is :value.', 'active_url' => 'The :attribute is not a valid URL.', 'after' => 'The :attribute must be a date after :date.', 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', @@ -24,10 +25,10 @@ return [ 'before' => 'The :attribute must be a date before :date.', 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute must be between :min and :max.', + 'string' => 'The :attribute must be between :min and :max characters.', ], 'boolean' => 'The :attribute field must be true or false.', 'confirmed' => 'The :attribute confirmation does not match.', @@ -35,27 +36,31 @@ return [ 'date' => 'The :attribute is not a valid date.', 'date_equals' => 'The :attribute must be a date equal to :date.', 'date_format' => 'The :attribute does not match the format :format.', + 'declined' => 'The :attribute must be declined.', + 'declined_if' => 'The :attribute must be declined when :other is :value.', 'different' => 'The :attribute and :other must be different.', 'digits' => 'The :attribute must be :digits digits.', 'digits_between' => 'The :attribute must be between :min and :max digits.', 'dimensions' => 'The :attribute has invalid image dimensions.', 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', 'email' => 'The :attribute must be a valid email address.', 'ends_with' => 'The :attribute must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', 'gt' => [ - 'numeric' => 'The :attribute must be greater than :value.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'string' => 'The :attribute must be greater than :value characters.', 'array' => 'The :attribute must have more than :value items.', + 'file' => 'The :attribute must be greater than :value kilobytes.', + 'numeric' => 'The :attribute must be greater than :value.', + 'string' => 'The :attribute must be greater than :value characters.', ], 'gte' => [ - 'numeric' => 'The :attribute must be greater than or equal :value.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'string' => 'The :attribute must be greater than or equal :value characters.', 'array' => 'The :attribute must have :value items or more.', + 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute must be greater than or equal to :value.', + 'string' => 'The :attribute must be greater than or equal to :value characters.', ], 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', @@ -66,61 +71,70 @@ return [ 'ipv6' => 'The :attribute must be a valid IPv6 address.', 'json' => 'The :attribute must be a valid JSON string.', 'lt' => [ - 'numeric' => 'The :attribute must be less than :value.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'string' => 'The :attribute must be less than :value characters.', 'array' => 'The :attribute must have less than :value items.', + 'file' => 'The :attribute must be less than :value kilobytes.', + 'numeric' => 'The :attribute must be less than :value.', + 'string' => 'The :attribute must be less than :value characters.', ], 'lte' => [ - 'numeric' => 'The :attribute must be less than or equal :value.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'string' => 'The :attribute must be less than or equal :value characters.', 'array' => 'The :attribute must not have more than :value items.', + 'file' => 'The :attribute must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute must be less than or equal to :value.', + 'string' => 'The :attribute must be less than or equal to :value characters.', ], + 'mac_address' => 'The :attribute must be a valid MAC address.', 'max' => [ - 'numeric' => 'The :attribute must not be greater than :max.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'string' => 'The :attribute must not be greater than :max characters.', 'array' => 'The :attribute must not have more than :max items.', + 'file' => 'The :attribute must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute must not be greater than :max.', + 'string' => 'The :attribute must not be greater than :max characters.', ], 'mimes' => 'The :attribute must be a file of type: :values.', 'mimetypes' => 'The :attribute must be a file of type: :values.', 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', 'array' => 'The :attribute must have at least :min items.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'numeric' => 'The :attribute must be at least :min.', + 'string' => 'The :attribute must be at least :min characters.', ], 'multiple_of' => 'The :attribute must be a multiple of :value.', 'not_in' => 'The selected :attribute is invalid.', 'not_regex' => 'The :attribute format is invalid.', 'numeric' => 'The :attribute must be a number.', - 'password' => 'The password is incorrect.', + 'password' => [ + 'letters' => 'The :attribute must contain at least one letter.', + 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute must contain at least one number.', + 'symbols' => 'The :attribute must contain at least one symbol.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', + ], 'present' => 'The :attribute field must be present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', 'regex' => 'The :attribute format is invalid.', 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', 'required_if' => 'The :attribute field is required when :other is :value.', 'required_unless' => 'The :attribute field is required unless :other is in :values.', 'required_with' => 'The :attribute field is required when :values is present.', 'required_with_all' => 'The :attribute field is required when :values are present.', 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', 'same' => 'The :attribute and :other must match.', 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', + 'file' => 'The :attribute must be :size kilobytes.', + 'numeric' => 'The :attribute must be :size.', + 'string' => 'The :attribute must be :size characters.', ], 'starts_with' => 'The :attribute must start with one of the following: :values.', 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', + 'timezone' => 'The :attribute must be a valid timezone.', 'unique' => 'The :attribute has already been taken.', 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', + 'url' => 'The :attribute must be a valid URL.', 'uuid' => 'The :attribute must be a valid UUID.', /* From 114af3d04d163a400d575faf9be1c65858a6ef6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 26 Jul 2022 17:43:17 +0300 Subject: [PATCH 3/4] fixed contact and category set edit form model data.. --- app/View/Components/Form/Group/Category.php | 2 +- app/View/Components/Form/Group/Contact.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/View/Components/Form/Group/Category.php b/app/View/Components/Form/Group/Category.php index 609ad1ec3..57c583693 100644 --- a/app/View/Components/Form/Group/Category.php +++ b/app/View/Components/Form/Group/Category.php @@ -29,7 +29,7 @@ class Category extends Form $this->path = route('modals.categories.create', ['type' => $this->type]); $this->remoteAction = route('categories.index', ['search' => 'type:' . $this->type . ' enabled:1']); - $this->categories = Model::type($this->type)->enabled()->orderBy('name')->take(setting('default.select_limit'))->get(); + $this->categories = Model::type($this->type)->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); $model = $this->getParentData('model'); diff --git a/app/View/Components/Form/Group/Contact.php b/app/View/Components/Form/Group/Contact.php index e471d73ec..9baa00e51 100644 --- a/app/View/Components/Form/Group/Contact.php +++ b/app/View/Components/Form/Group/Contact.php @@ -35,7 +35,7 @@ class Contact extends Form $this->label = trans_choice('general.' . Str::plural($this->type), 1); - $this->contacts = Model::type($this->type)->enabled()->orderBy('name')->take(setting('default.select_limit'))->get(); + $this->contacts = Model::type($this->type)->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id'); $model = $this->getParentData('model'); From 6c23d8daf6e0578853b786c53c3253f2dfa149f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 26 Jul 2022 18:29:38 +0300 Subject: [PATCH 4/4] fixed set account for reconciliation ( #3695j9y ) --- .../banking/reconciliations/create.blade.php | 21 +++++++++++-------- .../banking/reconciliations/edit.blade.php | 16 +++++++------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/resources/views/banking/reconciliations/create.blade.php b/resources/views/banking/reconciliations/create.blade.php index 6cfcb8a90..a84f7b958 100644 --- a/resources/views/banking/reconciliations/create.blade.php +++ b/resources/views/banking/reconciliations/create.blade.php @@ -51,7 +51,10 @@ :currency="$currency" /> - +
- + {{ trans('reconciliations.opening_balance') }}: - + @@ -179,11 +182,11 @@ - + {{ trans('reconciliations.closing_balance') }}: - + - + {{ trans('reconciliations.cleared_amount') }}: - + - + {{ trans('general.difference') }} - +
- + {{ trans('reconciliations.opening_balance') }}: - + @@ -117,11 +117,11 @@ - + {{ trans('reconciliations.closing_balance') }}: - + - + {{ trans('reconciliations.cleared_amount') }}: - + - + {{ trans('general.difference') }} - +