diff --git a/app/Http/Livewire/BookCase/CommentBookCase.php b/app/Http/Livewire/BookCase/CommentBookCase.php
index fa8a4a53..00a4144e 100644
--- a/app/Http/Livewire/BookCase/CommentBookCase.php
+++ b/app/Http/Livewire/BookCase/CommentBookCase.php
@@ -21,6 +21,8 @@ class CommentBookCase extends Component
public BookCase $bookCase;
+
+
public function render()
{
return view('livewire.book-case.comment-book-case')
diff --git a/app/Http/Livewire/BookCase/Form/OrangePillForm.php b/app/Http/Livewire/BookCase/Form/OrangePillForm.php
new file mode 100644
index 00000000..c1993400
--- /dev/null
+++ b/app/Http/Livewire/BookCase/Form/OrangePillForm.php
@@ -0,0 +1,73 @@
+ ['except' => '']];
+
+ public function rules()
+ {
+ return [
+ 'orangePill.book_case_id' => 'required',
+ 'orangePill.user_id' => 'required',
+ 'orangePill.amount' => 'required|numeric',
+ 'orangePill.date' => 'required|date',
+ 'orangePill.comment' => 'required|string',
+ 'image' => 'image|max:8192', // 8MB Max
+ ];
+ }
+
+ public function mount()
+ {
+ if (!$this->orangePill) {
+ $this->orangePill = new OrangePill([
+ 'user_id' => auth()->id(),
+ 'book_case_id' => $this->bookCase->id,
+ 'date' => now(),
+ 'amount' => 1,
+ ]);
+ }
+ }
+
+ public function save()
+ {
+ $this->validate();
+ $this->orangePill->save();
+ $this->orangePill
+ ->addMedia($this->image)
+ ->usingFileName(md5($this->image->getClientOriginalName()).'.'.$this->image->getClientOriginalExtension())
+ ->toMediaCollection('images');
+
+ return redirect($this->fromUrl);
+ }
+
+ public function deleteMe()
+ {
+ $this->orangePill->delete();
+
+ return redirect($this->fromUrl);
+ }
+
+ public function render()
+ {
+ return view('livewire.book-case.form.orange-pill-form');
+ }
+}
diff --git a/app/Http/Livewire/BookCase/WorldMap.php b/app/Http/Livewire/BookCase/WorldMap.php
index 674f01fd..d85f16c0 100644
--- a/app/Http/Livewire/BookCase/WorldMap.php
+++ b/app/Http/Livewire/BookCase/WorldMap.php
@@ -21,14 +21,10 @@ class WorldMap extends Component
->map(fn($bookCase) => [
'lat' => $bookCase->latitude,
'lng' => $bookCase->longitude,
- 'url' => url()->route('bookCases.table.bookcases',
+ 'url' => url()->route('bookCases.comment.bookcase',
[
- 'country' => $this->country,
- 'bookcases' => [
- 'filters' => [
- 'byids' => $bookCase->id,
- ]
- ]
+ 'country' => $this->country,
+ 'bookCase' => $bookCase,
]),
'op' => $bookCase->orange_pills_count,
])
diff --git a/database/migrations/2023_02_16_183823_add_comment_field_to_orange_pills_table.php b/database/migrations/2023_02_16_183823_add_comment_field_to_orange_pills_table.php
new file mode 100644
index 00000000..bfa8948f
--- /dev/null
+++ b/database/migrations/2023_02_16_183823_add_comment_field_to_orange_pills_table.php
@@ -0,0 +1,30 @@
+text('comment')
+ ->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('orange_pills', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/resources/views/columns/book_cases/oranged-pilled.blade.php b/resources/views/columns/book_cases/oranged-pilled.blade.php
index 6f345d9c..35c790d4 100644
--- a/resources/views/columns/book_cases/oranged-pilled.blade.php
+++ b/resources/views/columns/book_cases/oranged-pilled.blade.php
@@ -10,9 +10,16 @@
@endif
-
{{ $orangePill->comment }}
+{{ $orangePill->comment }}
+{{ $orangePill->date->asDateTime() }}
+Information
{{ $bookCase->comment }}
- -Neues Foto hochladen
- - - - @if($bookCase->getMedia('images')->count() > 0) -