feat: add legal opinions admin management
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\LegalOpinionCategory;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LegalOpinionCategoryController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = LegalOpinionCategory::query();
|
||||
|
||||
if ($request->filled('q')) {
|
||||
$q = $request->q;
|
||||
$query->where('name', 'like', "%{$q}%");
|
||||
}
|
||||
|
||||
$perPage = min(max((int) $request->input('per_page', 15), 10), 100);
|
||||
$categories = $query->paginate($perPage)->withQueryString();
|
||||
|
||||
return view('admin.legal-opinion-category.index', compact('categories'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.legal-opinion-category.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|unique:legal_opinion_categories,name',
|
||||
]);
|
||||
|
||||
LegalOpinionCategory::create($validated);
|
||||
|
||||
return redirect(route('legal-opinion-category.index'));
|
||||
}
|
||||
|
||||
public function edit(LegalOpinionCategory $legalOpinionCategory)
|
||||
{
|
||||
return view('admin.legal-opinion-category.update', compact('legalOpinionCategory'));
|
||||
}
|
||||
|
||||
public function show(LegalOpinionCategory $legalOpinionCategory)
|
||||
{
|
||||
return redirect(route('legal-opinion-category.edit', $legalOpinionCategory->id));
|
||||
}
|
||||
|
||||
public function update(Request $request, LegalOpinionCategory $legalOpinionCategory)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|unique:legal_opinion_categories,name,' . $legalOpinionCategory->id,
|
||||
]);
|
||||
|
||||
$legalOpinionCategory->update($validated);
|
||||
|
||||
return redirect(route('legal-opinion-category.edit', $legalOpinionCategory->id));
|
||||
}
|
||||
|
||||
public function destroy(LegalOpinionCategory $legalOpinionCategory)
|
||||
{
|
||||
$legalOpinionCategory->delete();
|
||||
|
||||
return redirect(route('legal-opinion-category.index'));
|
||||
}
|
||||
}
|
||||
126
app/Http/Controllers/Admin/LegalOpinionController.php
Normal file
126
app/Http/Controllers/Admin/LegalOpinionController.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Art;
|
||||
use App\Models\LegalOpinion;
|
||||
use App\Models\LegalOpinionCategory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class LegalOpinionController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = LegalOpinion::with('category');
|
||||
|
||||
if ($request->filled('q')) {
|
||||
$q = $request->q;
|
||||
$query->where(function ($qry) use ($q) {
|
||||
$qry->where('opinion_number', 'like', "%{$q}%")
|
||||
->orWhere('subject', 'like', "%{$q}%")
|
||||
->orWhere('full_text', 'like', "%{$q}%")
|
||||
->orWhere('issuing_authority', 'like', "%{$q}%");
|
||||
});
|
||||
}
|
||||
|
||||
$perPage = min(max((int) $request->input('per_page', 15), 10), 100);
|
||||
$legalOpinions = $query->latest()->paginate($perPage)->withQueryString();
|
||||
|
||||
return view('admin.legal-opinion.index', compact('legalOpinions'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$arts = Art::all();
|
||||
$categories = LegalOpinionCategory::all();
|
||||
|
||||
return view('admin.legal-opinion.create', compact('arts', 'categories'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'opinion_number' => [
|
||||
'required',
|
||||
Rule::unique('legal_opinions', 'opinion_number')->where('category_id', $request->input('category_id')),
|
||||
],
|
||||
'opinion_date' => 'nullable|date',
|
||||
'subject' => 'nullable|string|max:1000',
|
||||
'full_text' => 'required|string',
|
||||
'issuing_authority' => 'nullable|string',
|
||||
'category_id' => 'required|exists:legal_opinion_categories,id',
|
||||
'art_ids' => 'nullable|array',
|
||||
'art_ids.*' => 'exists:art,id',
|
||||
]);
|
||||
|
||||
$legalOpinion = LegalOpinion::create([
|
||||
'opinion_number' => $validated['opinion_number'],
|
||||
'opinion_date' => $validated['opinion_date'] ?? null,
|
||||
'subject' => $validated['subject'] ?? null,
|
||||
'full_text' => $validated['full_text'],
|
||||
'issuing_authority' => $validated['issuing_authority'] ?? null,
|
||||
'category_id' => $validated['category_id'],
|
||||
]);
|
||||
|
||||
if (!empty($validated['art_ids'])) {
|
||||
$legalOpinion->arts()->attach($validated['art_ids']);
|
||||
}
|
||||
|
||||
return redirect(route('legal-opinion.index'));
|
||||
}
|
||||
|
||||
public function edit(LegalOpinion $legalOpinion)
|
||||
{
|
||||
$arts = Art::all();
|
||||
$categories = LegalOpinionCategory::all();
|
||||
$selectedArtIds = $legalOpinion->arts->pluck('id')->toArray();
|
||||
|
||||
return view('admin.legal-opinion.update', compact('legalOpinion', 'arts', 'categories', 'selectedArtIds'));
|
||||
}
|
||||
|
||||
public function show(LegalOpinion $legalOpinion)
|
||||
{
|
||||
return redirect(route('legal-opinion.edit', $legalOpinion->id));
|
||||
}
|
||||
|
||||
public function update(Request $request, LegalOpinion $legalOpinion)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'opinion_number' => [
|
||||
'required',
|
||||
Rule::unique('legal_opinions', 'opinion_number')
|
||||
->where('category_id', $request->input('category_id'))
|
||||
->ignore($legalOpinion->id),
|
||||
],
|
||||
'opinion_date' => 'nullable|date',
|
||||
'subject' => 'nullable|string|max:1000',
|
||||
'full_text' => 'required|string',
|
||||
'issuing_authority' => 'nullable|string',
|
||||
'category_id' => 'required|exists:legal_opinion_categories,id',
|
||||
'art_ids' => 'nullable|array',
|
||||
'art_ids.*' => 'exists:art,id',
|
||||
]);
|
||||
|
||||
$legalOpinion->update([
|
||||
'opinion_number' => $validated['opinion_number'],
|
||||
'opinion_date' => $validated['opinion_date'] ?? null,
|
||||
'subject' => $validated['subject'] ?? null,
|
||||
'full_text' => $validated['full_text'],
|
||||
'issuing_authority' => $validated['issuing_authority'] ?? null,
|
||||
'category_id' => $validated['category_id'],
|
||||
]);
|
||||
|
||||
$legalOpinion->arts()->sync($validated['art_ids'] ?? []);
|
||||
|
||||
return redirect(route('legal-opinion.edit', $legalOpinion->id));
|
||||
}
|
||||
|
||||
public function destroy(LegalOpinion $legalOpinion)
|
||||
{
|
||||
$legalOpinion->delete();
|
||||
|
||||
return redirect(route('legal-opinion.index'));
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,11 @@ class Art extends Model
|
||||
return $this->belongsToMany(JudicialPrecedent::class, 'art_judicial_precedent');
|
||||
}
|
||||
|
||||
public function legalOpinions()
|
||||
{
|
||||
return $this->belongsToMany(LegalOpinion::class, 'art_legal_opinion');
|
||||
}
|
||||
|
||||
public static function search($searchTerm)
|
||||
{
|
||||
return self::where('title', 'LIKE', "%{$searchTerm}%")
|
||||
|
||||
32
app/Models/LegalOpinion.php
Normal file
32
app/Models/LegalOpinion.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LegalOpinion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'opinion_number',
|
||||
'opinion_date',
|
||||
'subject',
|
||||
'full_text',
|
||||
'issuing_authority',
|
||||
'category_id',
|
||||
];
|
||||
|
||||
protected $hidden = ['created_at', 'updated_at'];
|
||||
|
||||
public function arts()
|
||||
{
|
||||
return $this->belongsToMany(Art::class, 'art_legal_opinion');
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(LegalOpinionCategory::class, 'category_id');
|
||||
}
|
||||
}
|
||||
18
app/Models/LegalOpinionCategory.php
Normal file
18
app/Models/LegalOpinionCategory.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LegalOpinionCategory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function legalOpinions()
|
||||
{
|
||||
return $this->hasMany(LegalOpinion::class, 'category_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('legal_opinion_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->unique()->comment('نام دستهبندی');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('legal_opinion_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('legal_opinions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('opinion_number')->comment('شماره نظریه');
|
||||
$table->date('opinion_date')->nullable()->comment('تاریخ نظریه');
|
||||
$table->string('subject', 1000)->nullable()->comment('موضوع استعلام یا نظریه');
|
||||
$table->longText('full_text')->comment('متن کامل نظریه و استعلام');
|
||||
$table->string('issuing_authority')->nullable()->comment('مرجع صدور');
|
||||
$table->foreignId('category_id')->constrained('legal_opinion_categories')->onDelete('cascade')->comment('شناسه دستهبندی');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['opinion_number', 'category_id'], 'unique_opinion_category');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('legal_opinions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('art_legal_opinion', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('art_id')->constrained('art')->onDelete('cascade');
|
||||
$table->foreignId('legal_opinion_id')->constrained('legal_opinions')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['art_id', 'legal_opinion_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('art_legal_opinion');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
@include('admin.layouts.errors')
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">افزودن دستهبندی نظریه حقوقی</h4>
|
||||
<div>
|
||||
<form action="{{ route('legal-opinion-category.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="mb-4">
|
||||
<label for="name">نام دستهبندی</label>
|
||||
<input class="form-control" name="name" type="text" placeholder="نام دستهبندی" required>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" type="submit">ذخیره</button>
|
||||
<a href="{{ route('legal-opinion-category.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
44
resources/views/admin/legal-opinion-category/index.blade.php
Normal file
44
resources/views/admin/legal-opinion-category/index.blade.php
Normal file
@@ -0,0 +1,44 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@include('admin.partial.list-filter', ['filterRoute' => 'legal-opinion-category.index'])
|
||||
<div id="datatable_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="datatable" class="table table-bordered dt-responsive nowrap dataTable no-footer dtr-inline" style="border-collapse: collapse; border-spacing: 0px; width: 100%;" role="grid" aria-describedby="datatable_info">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th>نام دستهبندی</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($categories as $category)
|
||||
<tr>
|
||||
<td>{{ $category->name }}</td>
|
||||
<td>
|
||||
<form action="{{ route('legal-opinion-category.destroy', $category->id) }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger waves-effect waves-light" onclick="return confirm('آیا مطمئنید که میخواهید این دستهبندی را حذف کنید؟')">حذف</button>
|
||||
</form>
|
||||
<a href="{{ route('legal-opinion-category.edit', $category->id) }}" type="button" class="btn btn-primary waves-effect waves-light">ویرایش</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center mt-3">
|
||||
{{ $categories->withQueryString()->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,26 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
@include('admin.layouts.errors')
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">ویرایش دستهبندی نظریه حقوقی</h4>
|
||||
<div>
|
||||
<form action="{{ route('legal-opinion-category.update', $legalOpinionCategory->id) }}" method="post">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-4">
|
||||
<label for="name">نام دستهبندی</label>
|
||||
<input class="form-control" name="name" type="text" value="{{ $legalOpinionCategory->name }}" placeholder="نام دستهبندی" required>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" type="submit">بروزرسانی</button>
|
||||
<a href="{{ route('legal-opinion-category.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
65
resources/views/admin/legal-opinion/create.blade.php
Normal file
65
resources/views/admin/legal-opinion/create.blade.php
Normal file
@@ -0,0 +1,65 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
@include('admin.layouts.errors')
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">افزودن نظریه حقوقی</h4>
|
||||
<div>
|
||||
<form action="{{ route('legal-opinion.store') }}" method="post">
|
||||
@csrf
|
||||
<div class="mb-4">
|
||||
<label for="opinion_number">شماره نظریه</label>
|
||||
<input class="form-control" name="opinion_number" type="text" placeholder="شماره نظریه" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="opinion_date">تاریخ نظریه</label>
|
||||
<input class="form-control" name="opinion_date" type="date">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="subject">موضوع استعلام یا نظریه</label>
|
||||
<input class="form-control" name="subject" type="text" placeholder="موضوع استعلام یا نظریه">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="full_text">متن کامل نظریه و استعلام</label>
|
||||
<textarea class="form-control" name="full_text" id="full_text" cols="30" rows="10" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="issuing_authority">مرجع صدور</label>
|
||||
<input class="form-control" name="issuing_authority" type="text" placeholder="مرجع صدور">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="category_id">دستهبندی</label>
|
||||
<select class="form-control" name="category_id" id="category_id" required>
|
||||
<option value="">انتخاب دستهبندی</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="art_ids">مواد مرتبط</label>
|
||||
<select class="form-control" name="art_ids[]" id="art_ids" multiple size="10">
|
||||
@foreach ($arts as $art)
|
||||
<option value="{{ $art->id }}">{{ $art->title }} - شماره {{ $art->number }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="form-text text-muted">برای انتخاب چند ماده، کلید Ctrl (یا Cmd در Mac) را نگه دارید</small>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" type="submit">ذخیره</button>
|
||||
<a href="{{ route('legal-opinion.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
52
resources/views/admin/legal-opinion/index.blade.php
Normal file
52
resources/views/admin/legal-opinion/index.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@include('admin.partial.list-filter', ['filterRoute' => 'legal-opinion.index'])
|
||||
<div id="datatable_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="datatable" class="table table-bordered dt-responsive nowrap dataTable no-footer dtr-inline" style="border-collapse: collapse; border-spacing: 0px; width: 100%;" role="grid" aria-describedby="datatable_info">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th>شماره نظریه</th>
|
||||
<th>تاریخ نظریه</th>
|
||||
<th>موضوع</th>
|
||||
<th>دستهبندی</th>
|
||||
<th>مرجع صدور</th>
|
||||
<th>عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($legalOpinions as $opinion)
|
||||
<tr>
|
||||
<td>{{ $opinion->opinion_number }}</td>
|
||||
<td>{{ $opinion->opinion_date }}</td>
|
||||
<td>{{ $opinion->subject }}</td>
|
||||
<td>{{ $opinion->category?->name }}</td>
|
||||
<td>{{ $opinion->issuing_authority }}</td>
|
||||
<td>
|
||||
<form action="{{ route('legal-opinion.destroy', $opinion->id) }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger waves-effect waves-light" onclick="return confirm('آیا مطمئنید که میخواهید این نظریه را حذف کنید؟')">حذف</button>
|
||||
</form>
|
||||
<a href="{{ route('legal-opinion.edit', $opinion->id) }}" type="button" class="btn btn-primary waves-effect waves-light">ویرایش</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center mt-3">
|
||||
{{ $legalOpinions->withQueryString()->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
66
resources/views/admin/legal-opinion/update.blade.php
Normal file
66
resources/views/admin/legal-opinion/update.blade.php
Normal file
@@ -0,0 +1,66 @@
|
||||
@extends('admin.layouts.app')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
@include('admin.layouts.errors')
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">ویرایش نظریه حقوقی</h4>
|
||||
<div>
|
||||
<form action="{{ route('legal-opinion.update', $legalOpinion->id) }}" method="post">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-4">
|
||||
<label for="opinion_number">شماره نظریه</label>
|
||||
<input class="form-control" name="opinion_number" type="text" value="{{ $legalOpinion->opinion_number }}" placeholder="شماره نظریه" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="opinion_date">تاریخ نظریه</label>
|
||||
<input class="form-control" name="opinion_date" type="date" value="{{ $legalOpinion->opinion_date }}">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="subject">موضوع استعلام یا نظریه</label>
|
||||
<input class="form-control" name="subject" type="text" value="{{ $legalOpinion->subject }}" placeholder="موضوع استعلام یا نظریه">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="full_text">متن کامل نظریه و استعلام</label>
|
||||
<textarea class="form-control" name="full_text" id="full_text" cols="30" rows="10" required>{{ $legalOpinion->full_text }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="issuing_authority">مرجع صدور</label>
|
||||
<input class="form-control" name="issuing_authority" type="text" value="{{ $legalOpinion->issuing_authority }}" placeholder="مرجع صدور">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="category_id">دستهبندی</label>
|
||||
<select class="form-control" name="category_id" id="category_id" required>
|
||||
<option value="">انتخاب دستهبندی</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}" {{ $legalOpinion->category_id == $category->id ? 'selected' : '' }}>{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="art_ids">مواد مرتبط</label>
|
||||
<select class="form-control" name="art_ids[]" id="art_ids" multiple size="10">
|
||||
@foreach ($arts as $art)
|
||||
<option value="{{ $art->id }}" {{ in_array($art->id, $selectedArtIds) ? 'selected' : '' }}>{{ $art->title }} - شماره {{ $art->number }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="form-text text-muted">برای انتخاب چند ماده، کلید Ctrl (یا Cmd در Mac) را نگه دارید</small>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" type="submit">بروزرسانی</button>
|
||||
<a href="{{ route('legal-opinion.index') }}" class="btn btn-secondary">بازگشت</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -220,6 +220,28 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
||||
<i class="mdi mdi-file-document-outline"></i>
|
||||
<span>نظریههای حقوقی</span>
|
||||
</a>
|
||||
<ul class="sub-menu" aria-expanded="false">
|
||||
<li><a href="{{ route('legal-opinion.index') }}">لیست نظریهها</a></li>
|
||||
<li><a href="{{ route('legal-opinion.create') }}">افزودن نظریه جدید</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span>دستهبندی نظریهها</span>
|
||||
</a>
|
||||
<ul class="sub-menu" aria-expanded="false">
|
||||
<li><a href="{{ route('legal-opinion-category.index') }}">لیست دستهبندیها</a></li>
|
||||
<li><a href="{{ route('legal-opinion-category.create') }}">افزودن دستهبندی جدید</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="javascript:%20void(0);" class="has-arrow waves-effect">
|
||||
<i class="mdi mdi-account-circle-outline"></i>
|
||||
|
||||
@@ -9,8 +9,11 @@ use App\Http\Controllers\Admin\ChapterController;
|
||||
use App\Http\Controllers\Admin\DivisionController;
|
||||
use App\Http\Controllers\Admin\GateController;
|
||||
use App\Http\Controllers\Admin\HomeController;
|
||||
use App\Http\Controllers\Admin\JudicialPrecedentController;
|
||||
use App\Http\Controllers\Admin\JudicialPrecedentCategoryController;
|
||||
use App\Http\Controllers\Admin\LawController;
|
||||
use App\Http\Controllers\Admin\LegalOpinionController;
|
||||
use App\Http\Controllers\Admin\LegalOpinionCategoryController;
|
||||
use App\Http\Controllers\Admin\NotificationController;
|
||||
use App\Http\Controllers\Admin\PartController;
|
||||
use App\Http\Controllers\Admin\SectionController;
|
||||
@@ -42,6 +45,7 @@ Route::middleware(['auth',config('jetstream.auth_session')])->group(function ()
|
||||
Route::resource('notifications', NotificationController::class);
|
||||
Route::resource('judicial-precedent', JudicialPrecedentController::class);
|
||||
Route::resource('judicial-precedent-category', JudicialPrecedentCategoryController::class);
|
||||
Route::resource('legal-opinion', LegalOpinionController::class);
|
||||
Route::resource('legal-opinion-category', LegalOpinionCategoryController::class);
|
||||
Route::get('suggestions',[SuggestionController::class,'index'])->name('suggestions.index');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user