231 lines
16 KiB
PHP
231 lines
16 KiB
PHP
@php use App\Http\Helpers\Helper; @endphp
|
|
@extends("frontend.layouts.master")
|
|
@section("content")
|
|
@if($ticket->count())
|
|
<div class="grid grid-cols-1 md:grid-cols-12 gap-6 mt-2">
|
|
<div class="md:col-span-8">
|
|
<div class="accordion divide-neutral/20 divide-y bg-white shadow rounded-lg mb-4">
|
|
<div class="accordion-item" id="delivery-basic">
|
|
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start"
|
|
aria-controls="delivery-basic-collapse" aria-expanded="false">
|
|
<i data-lucide="plus"
|
|
class="accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></i>
|
|
<i data-lucide="minus"
|
|
class="accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></i>
|
|
Trả lời
|
|
</button>
|
|
<div id="delivery-basic-collapse"
|
|
class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300"
|
|
aria-labelledby="delivery-basic" role="region">
|
|
<div class="px-5 pb-4 border-t border-gray-200">
|
|
<form class="space-y-4 py-3" action="{{ route('ticket.reply.store') }}"
|
|
enctype="multipart/form-data" method="post">
|
|
@csrf
|
|
<input type="hidden" name="ticket_num" value="{{ $ticket->first()->ticket_num }}">
|
|
<div>
|
|
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">Nội
|
|
dung</label>
|
|
<textarea class="ckeditor w-full border border-gray-300 rounded-md shadow-sm"
|
|
id="description" name="description"
|
|
rows="8">{{ old('description') }}</textarea>
|
|
</div>
|
|
<div>
|
|
<label for="formFile" class="block text-sm font-medium text-gray-700 mb-1">Đính
|
|
kèm
|
|
File</label>
|
|
<input
|
|
class="w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"
|
|
name="fileTicket" accept="image/png, image/jpeg" type="file" id="formFile">
|
|
<p class="mt-2 text-sm text-gray-500">
|
|
Các định dạng hỗ trợ: .jpg, .gif, .jpeg, .png (Tối đa: 1024MB/Tệp)
|
|
</p>
|
|
</div>
|
|
<div class="pt-4 border-t border-gray-200 text-right">
|
|
<button type="submit"
|
|
class="inline-flex items-center px-4 py-2 bg-indigo-600 border border-transparent rounded-md font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
Gửi yêu cầu
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Ticket Reply History -->
|
|
@foreach($ticket->all() as $item)
|
|
<!-- Staff Replies -->
|
|
@if($item->Reply && $item->Reply->first() && $item->Reply->first()->User)
|
|
@foreach($item->Reply as $_item)
|
|
<div class="mb-6 bg-blue-50 rounded-lg shadow-md overflow-hidden">
|
|
<div
|
|
class="flex flex-wrap items-center justify-between p-4 border-b border-blue-100">
|
|
<div class="flex items-center">
|
|
<div class="p-2 bg-blue-100 rounded-full">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-600"
|
|
viewBox="0 0 20 20" fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 005 10a1 1 0 10-2 0 8 8 0 004.3 9.944 8 8 0 002.7.056A5.986 5.986 0 0013 15.5a1 1 0 10-2 0 3.99 3.99 0 01-1.5 1.5z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
</div>
|
|
<span class="ml-3 font-medium text-gray-700">
|
|
{{ $_item->User->firstname .' '.$_item->User->lastname }}
|
|
</span>
|
|
</div>
|
|
<div class="mt-2 md:mt-0 text-right">
|
|
<span
|
|
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
|
Quản trị viên
|
|
</span>
|
|
<div class="text-sm text-gray-500 mt-1">{{ $_item->created_at }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="p-4 prose max-w-none">
|
|
{!! $_item->message !!}
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
|
|
<!-- Customer Ticket -->
|
|
<div class="mb-6 bg-white rounded-lg shadow-md overflow-hidden">
|
|
<div class="flex flex-wrap items-center justify-between p-4 border-b border-gray-200">
|
|
<div class="flex items-center">
|
|
<div class="p-2 bg-gray-100 rounded-full">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-600"
|
|
viewBox="0 0 20 20" fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
</div>
|
|
<span class="ml-3 font-medium text-gray-700">
|
|
{{ $item->Customer->firstname .' '.$item->Customer->lastname }}
|
|
</span>
|
|
</div>
|
|
<div class="mt-2 md:mt-0 text-right">
|
|
<span
|
|
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
Khách hàng
|
|
</span>
|
|
<div class="text-sm text-gray-500 mt-1">{{ $item->created_at }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="p-4 prose max-w-none">
|
|
{!! $item->description !!}
|
|
</div>
|
|
|
|
@php($data = json_decode($item->data))
|
|
@if($data->file)
|
|
<div class="p-4 border-t border-gray-200">
|
|
<div class="cursor-pointer"
|
|
onclick="return window.open('{{url('template/' . $data->file)}}')">
|
|
@php($file_info = pathinfo(url('template/' . $data->file)))
|
|
<div class="flex items-center border border-gray-200 rounded-lg overflow-hidden max-w-xs">
|
|
<div class="w-24 h-24 bg-gray-100 flex items-center justify-center">
|
|
<img src="{{url('template/' . $data->file)}}"
|
|
class="max-h-full max-w-full object-cover" alt="Attachment">
|
|
</div>
|
|
<div class="p-3 flex-1">
|
|
<div class="text-sm font-medium text-gray-700 truncate">
|
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
class="h-4 w-4 inline text-gray-500" viewBox="0 0 20 20"
|
|
fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
{{ $file_info['basename'] }}
|
|
</div>
|
|
<div class="text-xs text-gray-500 mt-1">
|
|
{{ filesize(public_path('template/' . $data->file))*0.001 }} KB
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<!-- Ticket Information Sidebar -->
|
|
<div class="md:col-span-4">
|
|
<h3 class="text-lg font-medium text-gray-900">
|
|
Thông tin Ticket
|
|
</h3>
|
|
<div class="mt-3 mb-6 bg-white shadow-md rounded-lg overflow-hidden">
|
|
<div class="p-4 border-b border-gray-200">
|
|
<p class="text-sm text-gray-500 mb-1">Người yêu cầu</p>
|
|
<p class="font-medium text-indigo-600">{{ $ticket->first()->Customer->firstname .' '.$ticket->first()->Customer->lastname }}</p>
|
|
</div>
|
|
<div class="p-4 border-b border-gray-200">
|
|
<p class="text-sm text-gray-500 mb-1">Phòng ban</p>
|
|
<p class="font-medium text-indigo-600">{{ $ticket->first()->room }}</p>
|
|
</div>
|
|
<div class="p-4 border-b border-gray-200">
|
|
<p class="text-sm text-gray-500 mb-1">Đã Gửi</p>
|
|
<p class="font-medium text-indigo-600">{{ $ticket->last()->created_at }}</p>
|
|
</div>
|
|
<div class="p-4 border-b border-gray-200">
|
|
<p class="text-sm text-gray-500 mb-1">Lần cập nhật cuối</p>
|
|
<p class="font-medium text-indigo-600">{{ $ticket->first()->created_at }}</p>
|
|
</div>
|
|
<div class="p-4">
|
|
<p class="text-sm text-gray-500 mb-1">Tình trạng</p>
|
|
{!! Helper::get_ticket_status($ticket->first()->status,$ticket->first()->Reply->first()) !!}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex space-x-3">
|
|
<a href="{{ route('ticket') }}"
|
|
class="flex-1 inline-flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-gray-500"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
Trở về
|
|
</a>
|
|
<form action="{{ route('ticket.closed') }}" class="flex-1" method="post">
|
|
@csrf
|
|
@method('put')
|
|
<input type="hidden" name="ticket_num" value="{{ $ticket->first()->ticket_num }}">
|
|
<button type="submit"
|
|
class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-[var(--color-primary)] hover:bg-[var(--color-primary)] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[var(--color-primary)] {{ $ticket->first()->status === 0 ? 'opacity-50 cursor-not-allowed' : '' }}">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" viewBox="0 0 20 20"
|
|
fill="currentColor">
|
|
<path fill-rule="evenodd"
|
|
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
clip-rule="evenodd"/>
|
|
</svg>
|
|
Đóng Ticket
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endsection
|
|
|
|
@push('viewScripts')
|
|
<script src="{{ asset("assets/lib/tinymce/tinymce.min.js") }}"></script>
|
|
<script type="text/javascript">
|
|
tinymce.init({
|
|
selector: '.ckeditor',
|
|
entity_encoding: "raw",
|
|
plugins: "autosave preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template code codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help"
|
|
});
|
|
</script>
|
|
@endpush
|