First Commit
This commit is contained in:
+128
@@ -0,0 +1,128 @@
|
||||
@extends("layouts.app")
|
||||
|
||||
@section("title", __("My Interests"))
|
||||
|
||||
@section("header")
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __("My Interests") }}
|
||||
</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
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- Left column: My Interests -->
|
||||
<div class="lg:col-span-1">
|
||||
<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">{{ __("Add Interest") }}</h3>
|
||||
<form method="POST" action="{{ route("admin.interests.store") }}">
|
||||
@csrf
|
||||
<div class="mb-4">
|
||||
<label for="interest" class="block text-sm font-medium text-gray-700 mb-2">{{ __("What topic are you interested in?") }}</label>
|
||||
<input type="text" name="interest" id="interest" required
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"
|
||||
placeholder="{{ __("e.g., Business, Technology, Marketing") }}">
|
||||
</div>
|
||||
<button type="submit" class="w-full bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition font-medium">
|
||||
{{ __("Add Interest") }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<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 Interests") }}</h3>
|
||||
@if($interests->count() > 0)
|
||||
<div class="space-y-2">
|
||||
@foreach($interests as $interest)
|
||||
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
||||
<span class="text-sm text-gray-700">{{ $interest->interest }}</span>
|
||||
<form action="{{ route("admin.interests.destroy", $interest) }}" method="POST" onsubmit="return confirm('{{ __("Are you sure?") }}')">
|
||||
@csrf
|
||||
@method("DELETE")
|
||||
<button type="submit" class="text-xs text-red-600 hover:text-red-800 font-medium">
|
||||
{{ __("Remove") }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<p class="text-sm text-gray-500">{{ __("You have not added any interests yet.") }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right column: AI Suggestions -->
|
||||
<div class="lg:col-span-2">
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-900">{{ __("AI Suggestions") }}</h3>
|
||||
<p class="text-sm text-gray-500 mt-1">{{ __("Based on your interests, the AI suggests the following subjects") }}</p>
|
||||
</div>
|
||||
<form action="{{ route("admin.interests.generateSuggestions") }}" method="POST">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex items-center px-4 py-2 bg-purple-600 text-white text-sm font-medium rounded-lg hover:bg-purple-700 transition">
|
||||
<svg class="w-4 h-4 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
|
||||
</svg>
|
||||
{{ __("Generate Suggestions") }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@if(session("suggestions"))
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
@foreach(session("suggestions") as $suggestion)
|
||||
<div class="border border-gray-200 rounded-lg p-5 hover:shadow-md transition">
|
||||
<div class="flex items-start justify-between mb-3">
|
||||
<h4 class="font-semibold text-gray-900">{{ $suggestion["name"] ?? "" }}</h4>
|
||||
<span class="text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded-full font-medium">{{ __("Suggestion") }}</span>
|
||||
</div>
|
||||
@if(!empty($suggestion["description"]))
|
||||
<p class="text-sm text-gray-600 mb-3">{{ $suggestion["description"] }}</p>
|
||||
@endif
|
||||
@if(!empty($suggestion["introduction"]))
|
||||
<p class="text-xs text-gray-500 italic mb-3">{{ \Illuminate\Support\Str::limit($suggestion["introduction"], 100) }}</p>
|
||||
@endif
|
||||
<form action="{{ route("admin.interests.createSubject") }}" method="POST" class="mt-3">
|
||||
@csrf
|
||||
<input type="hidden" name="name" value="{{ $suggestion["name"] ?? "" }}">
|
||||
<input type="hidden" name="description" value="{{ $suggestion["description"] ?? "" }}">
|
||||
<input type="hidden" name="introduction" value="{{ $suggestion["introduction"] ?? "" }}">
|
||||
<button type="submit" class="w-full text-center text-sm bg-purple-600 text-white px-3 py-2 rounded-lg hover:bg-purple-700 transition font-medium">
|
||||
{{ __("Create Automatically with AI") }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="text-center py-12">
|
||||
<svg class="w-12 h-12 text-gray-300 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/>
|
||||
</svg>
|
||||
<p class="text-gray-500">{{ __("Click 'Generate Suggestions' to receive AI-powered subject ideas based on your interests.") }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user