Files
ahrommag/resources/views/livewire/tools/panel-comments.blade.php
2025-11-16 12:43:07 +03:30

83 lines
3.9 KiB
PHP

<div>
<div>
@foreach ($comments->other as $another_comment)
<div class="mx-10">
<div>
<div x-show="(( (status==comment_status) && comment_seen==1)||(status=='new' && (comment_seen==0 || parent_reply>0))) || status=='all'"
class="p-5 rounded @if ($another_comment->type == 1)
bg-gray-400
@else
bg-gray-200
@endif flex flex-col gap-3 m-3">
<div>
<h4> name : {{ $another_comment->name }}</h4>
<p> message : {{ $another_comment->message }}</p>
<div class="flex gap-2" x-data="{ comment_status: '{{ $another_comment->status }}', comment_seen: '{{ $another_comment->seen }}' }">
{{-- <button class="p-2 mt-3 rounded bg-green-500">edit</button> --}}
@if ($another_comment->type == 1)
{{-- answer --}}
<button wire:click="delete_comment({{ $another_comment->id }})"
class="p-2 mt-3 rounded bg-red-500">delete</button>
@else
{{-- reply --}}
<button
@click="comment_seen==0?parent_reply=parent_reply-1:'',comment_status=1,comment_seen=1 "
wire:click="comment_status({{ $another_comment->id }},{{ true }},{{ $comment->id }})"
x-show="comment_status==0||comment_seen==0"
class="p-2 mt-3 rounded bg-green-500">accept</button>
<button
@click="comment_seen==0?parent_reply=parent_reply-1:'',comment_status=0,comment_seen=1"
wire:click="comment_status({{ $another_comment->id }},{{ true }},{{ $comment->id }})"
x-show="comment_status==1||comment_seen==0"
class="p-2 mt-3 rounded bg-red-500">reject</button>
@endif
</div>
</div>
<div>
@if ($another_comment->type != 1)
<div>
<button @click="answer_id='{{ $another_comment->id }}'"
class="bg-green-300 p-1 rounded"> answer </button>
<div>
<div @click.outside="answer_id=0"
x-show="answer_id=='{{ $another_comment->id }}'"
class="flex flex-col gap-5">
<form>
<div>
<input wire:model="comment_message" class="border p-1"
placeholder="message">
<button type="button"
wire:click="answer({{ $another_comment->id }})"
@click="answer_id=0" class="bg-green-300 p-1 rounded"> answer
</button>
<button @click="answer_id=0" class="bg-red-300 p-1 rounded"> close
</button>
</div>
</form>
</div>
</div>
</div>
@endif
</div>
</div>
</div>
<div>
@livewire('tools.panel-comments', ['comments' => $another_comment, 'comment' => $comment, 'blog_id' => $blog_id], key($another_comment->id))
</div>
</div>
@endforeach
</div>
</div>