chore: update document approval workflow and bug fixes
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ProjectDocuments\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProjectDocumentsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$projectUlid = $request->query('project');
|
||||
$project = $projectUlid ? \Modules\ProjectManagement\Models\Project::where('ulid', $projectUlid)->firstOrFail() : null;
|
||||
|
||||
$query = \Modules\DocumentManagement\Models\Document::with(['uploader:id,name', 'category', 'project', 'approvals.approver']);
|
||||
if ($project) {
|
||||
$query->where('project_id', $project->id);
|
||||
}
|
||||
|
||||
if ($search = $request->search) {
|
||||
$query->where('title', 'like', "%{$search}%");
|
||||
}
|
||||
if ($categoryId = $request->category_id) {
|
||||
$query->where('category_id', $categoryId);
|
||||
}
|
||||
if ($status = $request->status) {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
|
||||
$documents = $query->latest()->paginate(20)->withQueryString();
|
||||
$categories = \Modules\DocumentManagement\Models\DocumentCategory::all();
|
||||
$projects = \Modules\ProjectManagement\Models\Project::select('id', 'name', 'ulid')->get();
|
||||
|
||||
return \Inertia\Inertia::render('ProjectManagement::Projects/Modules/Documents', [
|
||||
'project' => $project,
|
||||
'documents' => $documents,
|
||||
'categories' => $categories,
|
||||
'projects' => $projects,
|
||||
'filters' => $request->only(['search', 'category_id', 'status']),
|
||||
'currentTab' => 'documents',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('projectdocuments::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('projectdocuments::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('projectdocuments::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user