WORKIGN COMMENTS

This commit is contained in:
Mark Gregory
2026-06-17 09:05:56 +01:00
parent 8060f7f086
commit 2df11f9f58
6 changed files with 97 additions and 63 deletions
@@ -43,31 +43,14 @@
</div>
@if (($reply_parent_id ?? null) === $comment->id)
<div class="mt-4 rounded-xl border border-blue-200 bg-blue-50 p-4 dark:border-blue-900 dark:bg-blue-950/40">
<div class="space-y-2">
<label for="ticket-reply-body-{{ $comment->id }}" class="block text-sm font-medium text-zinc-700 dark:text-zinc-200">Reply</label>
<textarea
id="ticket-reply-body-{{ $comment->id }}"
dusk="ticket-reply-body"
wire:key="reply-editor-{{ $comment->id }}"
wire:model.live="replyBody"
rows="4"
placeholder="Write a reply..."
class="block w-full rounded-xl border border-zinc-300 bg-white p-4 text-sm text-zinc-900 shadow-sm outline-none transition focus:border-emerald-500 focus:ring-2 focus:ring-emerald-500/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100"
></textarea>
@error('replyBody')
<div class="text-sm text-red-600">{{ $message }}</div>
@enderror
</div>
<form wire:submit="addReply" class="mt-4 rounded-xl border border-blue-200 bg-blue-50 p-4 dark:border-blue-900 dark:bg-blue-950/40">
<x-helpdesk::html-editor wire:key="reply-editor-{{ $comment->id }}" wire:model="replyBody" label="Reply" rows="4" placeholder="Write a reply..." />
<div class="mt-4 flex justify-end gap-2">
<button type="button" wire:click.prevent="cancelReply" class="inline-flex items-center justify-center rounded-xl bg-slate-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-slate-400/60">Cancel</button>
<button type="button" wire:click.prevent="addReply" wire:target="addReply" wire:loading.attr="disabled" class="inline-flex items-center justify-center rounded-xl bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-emerald-700 focus:outline-none focus:ring-2 focus:ring-emerald-400/60 disabled:cursor-not-allowed disabled:opacity-70">
<span wire:loading.remove wire:target="addReply">Post reply</span>
<span wire:loading wire:target="addReply">Posting...</span>
</button>
<flux:button type="button" wire:click="cancelReply" variant="ghost" class="!bg-slate-600 !text-white hover:!bg-slate-700 focus:!ring-slate-400/60">Cancel</flux:button>
<flux:button type="submit" variant="primary" class="!bg-emerald-600 !text-white hover:!bg-emerald-700 focus:!ring-emerald-400/60">Post reply</flux:button>
</div>
</div>
</form>
@endif
@if ($commentReplies->isNotEmpty())