Documents create begin

This commit is contained in:
Александр Бабкин
2022-07-01 16:41:22 +03:00
parent 0b666ae79a
commit 17b364b1e3
5 changed files with 60 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Document;
use App\Models\Project;
class DocumentController extends Controller
{
@@ -16,18 +17,23 @@ class DocumentController extends Controller
public function index(Request $request)
{
$project_id = $request->session()->get('project_id');
$project = Project::find($project_id);
$documents = Document::find($project_id);
return view('documents.list', ['documents' => $documents]);
return view('documents.list', ['project' => $project, 'documents' => $documents]);
}
/**
* Show the form for creating a new resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function create()
public function create(Request $request)
{
//
$project_id = $request->session()->get('project_id');
$project = Project::find($project_id);
$documents = Document::find($project_id);
return view('documents.create', ['project' => $project, 'documents' => $documents]);
}
/**

View File

@@ -17,7 +17,7 @@ class MMCController extends Controller
{
$project_id = $request->session()->get('project_id');
$project = Project::find($project_id);
return view('mmc.show', ['project' => $project]);
return view('mmc.list', ['project' => $project]);
}
/**

View File

@@ -1,7 +1,7 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Create project') }}
{{ $project->name }}: {{ __('Create document') }}
</h2>
</x-slot>
@@ -19,35 +19,34 @@
</ul>
</div>
@endif
<form method="POST" action="{{ route('projects.store') }}">
<form method="POST" action="{{ route('documents.store') }}">
@csrf
<!-- Project name -->
<!-- Document name -->
<div>
<x-label for="name" :value="__('Title')" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus />
</div>
<!-- Description -->
<div class="mt-4">
<x-label for="description" :value="__('Description')" />
<div>
<x-label for="parent_id" :value="__('Parent document')" />
<x-input id="description" class="block mt-1 w-full" type="text" name="description" :value="old('description')" required />
{{-- <x-select>
<option>1</option>
</x-select> --}}
<select id="parent_id" class="block mt-1 w-full" type="select" name="parent_id" :value="old('parent_id')" required>
<option>1</option>
<option>1</option>
</select>
</div>
<!-- MMC Path -->
<div class="mt-4">
<x-label for="mmc_path" :value="__('MMC Path')" />
<x-input id="mmc_path" class="block mt-1 w-full" type="text" name="mmc_path" :value="old('mmc_path')" required />
</div>
<div class="flex items-center justify-end mt-4">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{ __('Create project') }}
<i class="fa fa-add pr-2"></i>{{ __('Create document') }}
</button>
<div class="pl-2">
<a href="{{ route('projects.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
<a href="{{ route('documents.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
</a>
</div>

View File

@@ -1,7 +1,7 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Project list') }}
{{ $project->name }}: {{ __('Document list') }}
</h2>
</x-slot>
@@ -9,13 +9,13 @@
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<a href="{{ route('projects.create')}}">
<a href="{{ route('documents.create')}}">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{__('Create project')}}
<i class="fa fa-add pr-2"></i>{{__('Create doucment')}}
</button>
</a>
<div align="center" class="pt-4">
{{-- <div align="center" class="pt-4">
<table class="table table-sm border-b border-gray-200">
<tr class="border border-gray-200">
<th class="p-2 border border-gray-200">
@@ -60,7 +60,7 @@
</tr>
@endforelse
</table>
</div>
</div> --}}
</div>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
<div class="flex flex-row">
<div class="basis-1/2">
{{ $project->name }}: {{ __('MMC List')}}
</div>
</div>
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<a href="{{ route('mmc.create')}}">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{__('Create mmc')}}
</button>
</a>
<div align="center" class="pt-4">
TODO: MMC table
<table class="table table-sm border-b border-gray-200">
</table>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>