diff --git a/app/Abstracts/View/Components/TransactionShow.php b/app/Abstracts/View/Components/TransactionShow.php
index 2291c17d6..2e4b1111e 100644
--- a/app/Abstracts/View/Components/TransactionShow.php
+++ b/app/Abstracts/View/Components/TransactionShow.php
@@ -314,6 +314,12 @@ abstract class TransactionShow extends Base
/** @var string */
public $classFooterHistories;
+ /** @var string */
+ public $textRecurringType;
+
+ /** @var bool */
+ public $hideRecurringMessage;
+
/**
* Create a new component instance.
*
@@ -346,7 +352,7 @@ abstract class TransactionShow extends Base
bool $hideAttachment = false, $attachment = [],
bool $hideFooter = false, bool $hideFooterHistories = false, $histories = [],
- string $textHistories = '', string $classFooterHistories = ''
+ string $textHistories = '', string $classFooterHistories = '', string $textRecurringType = '', bool $hideRecurringMessage = false
) {
$this->type = $type;
$this->transaction = $transaction;
@@ -354,6 +360,8 @@ abstract class TransactionShow extends Base
$this->logo = $this->getLogo($logo);
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
$this->date_format = $this->getCompanyDateFormat();
+ $this->textRecurringType = $this->getTextRecurringType($type, $textRecurringType);
+ $this->hideRecurringMessage = $hideRecurringMessage;
// Navbar Hide
$this->hideButtonAddNew = $hideButtonAddNew;
@@ -1276,4 +1284,21 @@ abstract class TransactionShow extends Base
return 'col-sm-6 col-md-6 col-lg-6 col-xl-6';
}
+
+ protected function getTextRecurringType($type, $textRecurringType)
+ {
+ if (!empty($textRecurringType)) {
+ return $textRecurringType;
+ }
+
+ $default_key = config('type.' . $type . '.translation.prefix');
+
+ $translation = $this->getTextFromConfig($type, 'recurring_tye', $default_key);
+
+ if (!empty($translation)) {
+ return $translation;
+ }
+
+ return 'general.revenues';
+ }
}
diff --git a/app/Http/Requests/Banking/Transaction.php b/app/Http/Requests/Banking/Transaction.php
index 1c1870302..bb1283add 100644
--- a/app/Http/Requests/Banking/Transaction.php
+++ b/app/Http/Requests/Banking/Transaction.php
@@ -32,6 +32,8 @@ class Transaction extends FormRequest
'category_id' => 'required|integer',
'payment_method' => 'required|string',
'attachment.*' => $attachment,
+ 'recurring_count' => 'gte:0',
+ 'recurring_interval' => 'exclude_unless:recurring_frequency,custom|gt:0',
];
}
diff --git a/app/Http/Requests/Document/Document.php b/app/Http/Requests/Document/Document.php
index 1b8398250..d67ba226a 100644
--- a/app/Http/Requests/Document/Document.php
+++ b/app/Http/Requests/Document/Document.php
@@ -61,6 +61,8 @@ class Document extends FormRequest
'category_id' => 'required|integer',
'company_logo' => $company_logo,
'attachment.*' => $attachment,
+ 'recurring_count' => 'gte:0',
+ 'recurring_interval' => 'exclude_unless:recurring_frequency,custom|gt:0',
];
$items = $this->request->get('items');
diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php
index 701747bf7..a9c351479 100644
--- a/app/Models/Banking/Transaction.php
+++ b/app/Models/Banking/Transaction.php
@@ -126,6 +126,11 @@ class Transaction extends Model
return $this->belongsTo('App\Models\Auth\User', 'contact_id', 'id');
}
+ public function parent()
+ {
+ return $this->belongsTo('App\Models\Banking\Transaction', 'parent_id');
+ }
+
/**
* Scope to only include contacts of a given type.
*
diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php
index c2c926c7d..522fc0a3d 100644
--- a/app/Models/Document/Document.php
+++ b/app/Models/Document/Document.php
@@ -144,6 +144,11 @@ class Document extends Model
return $this->totals()->orderBy('sort_order');
}
+ public function parent()
+ {
+ return $this->belongsTo('App\Models\Document\Document', 'parent_id');
+ }
+
public function scopeLatest(Builder $query)
{
return $query->orderBy('issued_at', 'desc');
diff --git a/app/View/Components/SearchString.php b/app/View/Components/SearchString.php
index 7859aeea8..fa7a575eb 100644
--- a/app/View/Components/SearchString.php
+++ b/app/View/Components/SearchString.php
@@ -89,12 +89,12 @@ class SearchString extends Component
$column = $options['key'];
}
- if (isset($options['relationship'])) {
- if (isset($options['foreign_key'])) {
- $column .= '.' . $options['foreign_key'];
- } else {
- $column .= '.id';
- }
+ if (isset($options['relationship']) && isset($options['foreign_key']) && !empty($options['foreign_key'])) {
+ $column .= '.' . $options['foreign_key'];
+ }
+
+ if (isset($options['relationship']) && !isset($options['foreign_key'])) {
+ $column .= '.id';
}
return $column;
diff --git a/config/search-string.php b/config/search-string.php
index 60dc341dc..9b070ba9d 100644
--- a/config/search-string.php
+++ b/config/search-string.php
@@ -112,6 +112,12 @@ return [
'route' => 'categories.index'
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'foreign_key' => '',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
@@ -205,6 +211,11 @@ return [
'route' => 'categories.index'
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
@@ -243,6 +254,12 @@ return [
'route' => ['categories.index', 'search=type:expense']
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'foreign_key' => '',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
@@ -269,6 +286,12 @@ return [
'route' => ['categories.index', 'search=type:expense']
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'foreign_key' => '',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
@@ -308,6 +331,12 @@ return [
'route' => ['categories.index', 'search=type:income']
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'foreign_key' => '',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
@@ -334,6 +363,12 @@ return [
'route' => ['categories.index', 'search=type:income']
],
'parent_id',
+ 'recurring' => [
+ 'key' => 'recurring',
+ 'foreign_key' => '',
+ 'relationship' => true,
+ 'boolean' => true,
+ ]
],
],
diff --git a/resources/assets/js/components/AkauntingRecurring.vue b/resources/assets/js/components/AkauntingRecurring.vue
index c4a813fce..ed9504ae6 100644
--- a/resources/assets/js/components/AkauntingRecurring.vue
+++ b/resources/assets/js/components/AkauntingRecurring.vue
@@ -4,6 +4,15 @@
name="recurring_frequency"
:class="frequencyClasses"
:error="frequencyError">
+
+
+
@@ -20,21 +29,19 @@
-
-
-
@@ -61,7 +67,7 @@