First Commit
This commit is contained in:
+137
@@ -0,0 +1,137 @@
|
||||
@extends("layouts.app")
|
||||
|
||||
@section("title", __("My Custom Subjects"))
|
||||
|
||||
@section("header")
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __("My Custom Subjects") }}
|
||||
</h2>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<div class="py-6">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
@if(session("success"))
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded-lg mb-6">
|
||||
{{ session("success") }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(session("error"))
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-lg mb-6">
|
||||
{{ session("error") }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Upload Form -->
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6 mb-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">{{ __("Upload PDF") }}</h3>
|
||||
<form action="{{ route("admin.custom-subjects.store") }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div class="md:col-span-1">
|
||||
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">{{ __("Subject Name") }} *</label>
|
||||
<input type="text" name="name" id="name" value="{{ old("name") }}" required
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 @error("name") border-red-500 @enderror">
|
||||
@error("name")
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="md:col-span-1">
|
||||
<label for="pdf" class="block text-sm font-medium text-gray-700 mb-2">{{ __("PDF File") }} *</label>
|
||||
<input type="file" name="pdf" id="pdf" accept=".pdf,application/pdf" required
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 @error("pdf") border-red-500 @enderror">
|
||||
@error("pdf")
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
<p class="text-xs text-gray-500 mt-1">{{ __("Maximum file size: 10MB") }}</p>
|
||||
</div>
|
||||
<div class="md:col-span-1 flex items-end">
|
||||
<button type="submit"
|
||||
class="w-full px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-lg hover:bg-indigo-700 transition">
|
||||
<svg class="w-4 h-4 inline mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/>
|
||||
</svg>
|
||||
{{ __("Upload and Process") }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Custom Subjects List -->
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">{{ __("My Custom Subjects") }}</h3>
|
||||
|
||||
@if($customSubjects->count() === 0)
|
||||
<p class="text-gray-500 text-center py-8">{{ __("No custom subjects yet. Upload a PDF to get started.") }}</p>
|
||||
@else
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Name") }}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Status") }}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Created") }}</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">{{ __("Actions") }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@foreach($customSubjects as $subject)
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">{{ $subject->name }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
@if($subject->processing_status === "completed")
|
||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
|
||||
{{ __("Ready") }}
|
||||
</span>
|
||||
@elseif($subject->processing_status === "processing")
|
||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
|
||||
{{ __("Processing") }}
|
||||
</span>
|
||||
@elseif($subject->processing_status === "failed")
|
||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
|
||||
{{ __("Failed") }}
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $subject->created_at->format("d/m/Y H:i") }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
||||
@if($subject->processing_status === "completed")
|
||||
<a href="{{ route("admin.custom-subjects.edit", $subject) }}"
|
||||
class="text-indigo-600 hover:text-indigo-900 mr-3">
|
||||
{{ __("Edit") }}
|
||||
</a>
|
||||
<a href="{{ route("admin.custom-subjects.show", $subject) }}"
|
||||
class="text-indigo-600 hover:text-indigo-900 mr-3">
|
||||
{{ __("Ask Questions") }}
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route("admin.custom-subjects.edit", $subject) }}"
|
||||
class="text-indigo-600 hover:text-indigo-900 mr-3">
|
||||
{{ __("Edit") }}
|
||||
</a>
|
||||
@endif
|
||||
<form action="{{ route("admin.custom-subjects.destroy", $subject) }}" method="POST" class="inline"
|
||||
onsubmit="return confirm('{{ __("Delete this custom subject? This action cannot be undone.") }}')">
|
||||
@csrf
|
||||
@method("DELETE")
|
||||
<button type="submit" class="text-red-600 hover:text-red-900">
|
||||
{{ __("Delete") }}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user