diff --git a/app/Models/Contract.php b/app/Models/Contract.php
index 0487dac..54ebed4 100644
--- a/app/Models/Contract.php
+++ b/app/Models/Contract.php
@@ -104,6 +104,11 @@ class Contract extends Model
return $this->hasMany(Payment::class);
}
+ public function deposit()
+ {
+ return $this->payments()->oldest('date')->first();
+ }
+
public function contact()
{
return $this->belongsTo(Contact::class)->withTrashed();
diff --git a/app/Models/Payment.php b/app/Models/Payment.php
index 11d2a0c..72fba6c 100644
--- a/app/Models/Payment.php
+++ b/app/Models/Payment.php
@@ -45,6 +45,11 @@ class Payment extends Model
return $type == PaymentType::Transaction() ? 'Überweisung' : 'Barzahlung';
}
+ public function getTypeTextAttribute()
+ {
+ return $this->type == PaymentType::Transaction() ? 'Als Überweisung erhalten' : 'in bar erhalten';
+ }
+
public function getDeleteLinkAttribute()
{
return route('payments.destroy', [$this->contract->id, $this->id]);
diff --git a/resources/views/contract.blade.php b/resources/views/contract.blade.php
index 1ee91f1..fc74710 100644
--- a/resources/views/contract.blade.php
+++ b/resources/views/contract.blade.php
@@ -208,18 +208,20 @@ Mündliche Vereinbarungen sind ungültig.
-
-
- | Quittung |
- Den Betrag von |
- in bar erhalten |
-
- | |
- | |
-
- | Datum: |
- |
-
-
+ @if ($contract->deposit())
+
+
+ | Quittung |
+ Den Betrag von {{ $contract->deposit()->amount->format() }} |
+ {{ $contract->deposit()->type_text }} |
+
+ | |
+ | |
+
+ | Datum: |
+ |
+
+
+ @endif