Documents ready
This commit is contained in:
@@ -18,8 +18,8 @@ class DocumentController extends Controller
|
||||
{
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
$documents = Document::where('project_id',$project_id)->get();
|
||||
return view('documents.list', ['project' => $project, 'documents' => $documents]);
|
||||
$top_documents = $project->documents()->where('parent_id',0)->get();
|
||||
return view('documents.list', ['project' => $project, 'top_documents' => $top_documents]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,8 +32,8 @@ class DocumentController extends Controller
|
||||
{
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
$documents = Document::where('project_id',$project_id)->get();
|
||||
return view('documents.create', ['project' => $project, 'documents' => $documents]);
|
||||
$top_documents = $project->documents()->where('parent_id',0)->get();
|
||||
return view('documents.create', ['project' => $project, 'top_documents' => $top_documents]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,12 +74,17 @@ class DocumentController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(Request $request,$id)
|
||||
{
|
||||
//
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
$top_documents = $project->documents()->where('parent_id',0)->get();
|
||||
$document = Document::find($id);
|
||||
return view('documents.edit', ['project' => $project, 'top_documents' => $top_documents, 'document' => $document]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +96,20 @@ class DocumentController extends Controller
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'parent_id' => 'required|integer|different:id',
|
||||
// 'parent_id' => ['required', 'integer','lt:'.$id,'gt:'.$id],
|
||||
]);
|
||||
|
||||
$document = Document::find($id);
|
||||
$document->name = $request->name;
|
||||
$document->project_id = $project_id;
|
||||
$document->parent_id = $request->parent_id;
|
||||
$document->save();
|
||||
|
||||
return redirect(route('documents.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,6 +120,7 @@ class DocumentController extends Controller
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
Document::findOrFail($id)->delete();
|
||||
return redirect()->route('documents.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,8 @@ class Document extends Model
|
||||
'parent_id',
|
||||
];
|
||||
|
||||
public function childs() {
|
||||
|
||||
return $this->hasMany('App\Category','parent_id','id') ;
|
||||
|
||||
public function childs()
|
||||
{
|
||||
return $this->hasMany('App\Models\Document','parent_id','id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,9 @@ class Project extends Model
|
||||
'description',
|
||||
'mmc_path',
|
||||
];
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->hasMany(Document::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,9 +697,6 @@ select {
|
||||
.z-50 {
|
||||
z-index: 50;
|
||||
}
|
||||
.m-2 {
|
||||
margin: 0.5rem;
|
||||
}
|
||||
.mx-auto {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@@ -716,9 +713,6 @@ select {
|
||||
.mt-4 {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.ml-4 {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.ml-1 {
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
@@ -731,6 +725,9 @@ select {
|
||||
.ml-2 {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.ml-4 {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
@@ -746,12 +743,12 @@ select {
|
||||
.mt-3 {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
.mt-6 {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.mb-4 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.mt-6 {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
@@ -800,6 +797,9 @@ select {
|
||||
.w-5 {
|
||||
width: 1.25rem;
|
||||
}
|
||||
.w-96 {
|
||||
width: 24rem;
|
||||
}
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -821,15 +821,15 @@ select {
|
||||
.w-20 {
|
||||
width: 5rem;
|
||||
}
|
||||
.w-96 {
|
||||
width: 24rem;
|
||||
}
|
||||
.max-w-7xl {
|
||||
max-width: 80rem;
|
||||
}
|
||||
.max-w-6xl {
|
||||
max-width: 72rem;
|
||||
}
|
||||
.max-w-xl {
|
||||
max-width: 36rem;
|
||||
}
|
||||
.flex-1 {
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
@@ -907,15 +907,15 @@ select {
|
||||
.rounded-md {
|
||||
border-radius: 0.375rem;
|
||||
}
|
||||
.rounded-full {
|
||||
border-radius: 9999px;
|
||||
}
|
||||
.rounded-lg {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.rounded-full {
|
||||
border-radius: 9999px;
|
||||
}
|
||||
.rounded-l-md {
|
||||
border-top-left-radius: 0.375rem;
|
||||
border-bottom-left-radius: 0.375rem;
|
||||
@@ -939,6 +939,9 @@ select {
|
||||
.border-l-4 {
|
||||
border-left-width: 4px;
|
||||
}
|
||||
.border-r {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
.border-gray-300 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||
@@ -958,6 +961,10 @@ select {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(129 140 248 / var(--tw-border-opacity));
|
||||
}
|
||||
.border-gray-400 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
||||
}
|
||||
.bg-white {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||
@@ -966,14 +973,6 @@ select {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-gray-800 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-indigo-50 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(238 242 255 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-blue-500 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
||||
@@ -982,6 +981,14 @@ select {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-gray-800 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-indigo-50 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(238 242 255 / var(--tw-bg-opacity));
|
||||
}
|
||||
.fill-current {
|
||||
fill: currentColor;
|
||||
}
|
||||
@@ -1027,6 +1034,15 @@ select {
|
||||
padding-left: 0.25rem;
|
||||
padding-right: 0.25rem;
|
||||
}
|
||||
.pr-2 {
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.pt-4 {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
.pt-8 {
|
||||
padding-top: 2rem;
|
||||
}
|
||||
@@ -1036,9 +1052,6 @@ select {
|
||||
.pb-3 {
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
.pt-4 {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
.pb-1 {
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
@@ -1054,12 +1067,6 @@ select {
|
||||
.pr-4 {
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.pr-2 {
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1110,6 +1117,9 @@ select {
|
||||
.tracking-widest {
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.tracking-wider {
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.text-gray-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
@@ -1122,6 +1132,14 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-white {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(239 68 68 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-gray-200 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(229 231 235 / var(--tw-text-opacity));
|
||||
@@ -1142,10 +1160,6 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(239 68 68 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-green-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(34 197 94 / var(--tw-text-opacity));
|
||||
@@ -1158,10 +1172,6 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(22 163 74 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-white {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-600 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(220 38 38 / var(--tw-text-opacity));
|
||||
@@ -9062,22 +9072,22 @@ readers do not read off random characters that represent icons */
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||
}
|
||||
.hover\:bg-gray-100:hover {
|
||||
.hover\:bg-blue-700:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-700:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-100:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-50:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-blue-700:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:text-gray-500:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
@@ -9086,18 +9096,6 @@ readers do not read off random characters that represent icons */
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(55 65 81 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-800:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-900:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-green-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(21 128 61 / var(--tw-text-opacity));
|
||||
@@ -9110,6 +9108,18 @@ readers do not read off random characters that represent icons */
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(185 28 28 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(55 65 81 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-900:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-800:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.focus\:z-10:focus {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
16
resources/views/documents/actions.blade.php
Normal file
16
resources/views/documents/actions.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
{{-- <a href="{{ route('documents.show',$document->id) }}">
|
||||
<i class="fa fa-eye text-green-500 hover:text-green-700 px-2 text-lg"></i>
|
||||
</a> --}}
|
||||
<a href="{{ route('documents.edit', $document->id) }}">
|
||||
<i class="fa fa-edit text-blue-500 hover:text-blue-700 px-2 text-lg"></i>
|
||||
</a>
|
||||
@if (!count($document->childs))
|
||||
<form class="inline-block" action="{{ route('documents.destroy', $document->id) }}" method="POST"
|
||||
onsubmit="return confirm('{{ __('Are you sure remove document ') . $document->name . '?' }}');">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
<button type="submit">
|
||||
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
|
||||
</button>
|
||||
</form>
|
||||
@endif
|
||||
@@ -11,13 +11,13 @@
|
||||
<div class="p-6 bg-white border-b border-gray-200">
|
||||
<div class="w-96 mx-auto">
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger text-red-500 p-2">
|
||||
<ul class="list-unstyled alert alert-danger">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div class="alert alert-danger text-red-500 p-2">
|
||||
<ul class="list-unstyled alert alert-danger">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="{{ route('documents.store') }}">
|
||||
@csrf
|
||||
@@ -25,7 +25,8 @@
|
||||
<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 />
|
||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name"
|
||||
:value="old('name')" required autofocus />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -33,20 +34,28 @@
|
||||
|
||||
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
|
||||
<option value="0">---</option>
|
||||
@foreach($documents as $document)
|
||||
<option value="{{ $document->id }}">{{ $document->name}}</option>
|
||||
@foreach ($top_documents as $document)
|
||||
<option value="{{ $document->id }}">{{ $document->name }}</option>
|
||||
@if (count($document->childs))
|
||||
@include('documents.optionChild', [
|
||||
'childs' => $document->childs,
|
||||
'level' => 1,
|
||||
])
|
||||
@endif
|
||||
@endforeach
|
||||
</x-select>
|
||||
</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">
|
||||
<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 document') }}
|
||||
</button>
|
||||
<div class="pl-2">
|
||||
<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 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>
|
||||
</div>
|
||||
@@ -56,4 +65,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
</x-app-layout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||
{{ __('Edit project') }}
|
||||
{{ $project->name }}: {{ __('Create document') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
@@ -11,40 +11,58 @@
|
||||
<div class="p-6 bg-white border-b border-gray-200">
|
||||
<div class="w-96 mx-auto">
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-danger text-red-500 p-2">
|
||||
<ul class="list-unstyled alert alert-danger">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<div class="alert alert-danger text-red-500 p-2">
|
||||
<ul class="list-unstyled alert alert-danger">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="{{ route('projects.update',$project->id) }}">
|
||||
<form method="POST" action="{{ route('documents.update',$document->id) }}">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<!-- Document name -->
|
||||
<input type="hidden" id="id" name="id" value="{{ $document->id }}">
|
||||
<div>
|
||||
<x-label for="name" :value="__('Title')" />
|
||||
<x-label for="name" value="{{ __('Title') }}" />
|
||||
|
||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $project->name }}" required autofocus />
|
||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name"
|
||||
value="{{ $document->name }}" required autofocus />
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<x-label for="description" :value="__('Description')" />
|
||||
|
||||
<x-input id="description" class="block mt-1 w-full" type="text" name="description" value="{{ $project->description }}" required />
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<x-label for="mmc_path" :value="__('MMC Path')" />
|
||||
<div>
|
||||
<x-label for="parent_id" :value="__('Parent document')" />
|
||||
|
||||
<x-input id="mmc_path" class="block mt-1 w-full" type="text" name="mmc_path" value="{{ $project->mmc_path }}" required />
|
||||
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
|
||||
<option value="0">---</option>
|
||||
@foreach ($top_documents as $top_document)
|
||||
@if ($document->parent_id == $top_document->id)
|
||||
<option value="{{ $top_document->id }}" selected>{{ $top_document->name }}</option>
|
||||
@else
|
||||
<option value="{{ $top_document->id }}">{{ $top_document->name }}</option>
|
||||
@endif
|
||||
@if (count($top_document->childs))
|
||||
@include('documents.optionChildSelected', [
|
||||
'childs' => $top_document->childs,
|
||||
'parent_id' => $document->parent_id,
|
||||
'level' => 1,
|
||||
])
|
||||
@endif
|
||||
@endforeach
|
||||
</x-select>
|
||||
</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>{{ __('Save') }}
|
||||
<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>{{ __('Save 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">
|
||||
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
||||
<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>
|
||||
</div>
|
||||
@@ -54,4 +72,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
</x-app-layout>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<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('documents.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 doucment')}}
|
||||
<i class="fa fa-add pr-2"></i>{{ __('Create doucment') }}
|
||||
</button>
|
||||
</a>
|
||||
|
||||
@@ -19,37 +19,37 @@
|
||||
<table class="table table-sm border-b border-gray-200">
|
||||
<tr class="border border-gray-200">
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('Title')}}
|
||||
{{ __('Title') }}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('Actions')}}
|
||||
{{ __('Actions') }}
|
||||
</th>
|
||||
</tr>
|
||||
@forelse ( $documents as $document)
|
||||
<tr class="border border-gray-200">
|
||||
<td class="p-2 border border-gray-200">{{ $document->name }}</td>
|
||||
<td class="p-2 border border-gray-200">
|
||||
<div class="text-center">
|
||||
{{-- <a href="{{ route('projects.show',$project->id) }}">
|
||||
<i class="fa fa-eye text-green-500 hover:text-green-700 px-2 text-lg"></i>
|
||||
</a>
|
||||
<a href="{{ route('projects.edit',$project->id) }}">
|
||||
<i class="fa fa-edit text-blue-500 hover:text-blue-700 px-2 text-lg"></i>
|
||||
</a>
|
||||
<form class="inline-block" action="{{ route('projects.destroy', $project->id) }}" method="POST" onsubmit="return confirm('{{ __('Are you sure remove project ').$project->name.'?' }}');">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||
<button type="submit">
|
||||
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
|
||||
</button>
|
||||
</form> --}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@forelse ($top_documents as $document)
|
||||
<tr class="border border-gray-200">
|
||||
<td class="p-2 border border-gray-200">{{ $document->name }}</td>
|
||||
<td class="p-2 border border-gray-200">
|
||||
<div class="text-center">
|
||||
@include('documents.actions', ['document' => $document])
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@if (count($document->childs))
|
||||
@php
|
||||
$level = 1;
|
||||
@endphp
|
||||
@include('documents.tableChild', [
|
||||
'childs' => $document->childs,
|
||||
'level' => $level,
|
||||
])
|
||||
@endif
|
||||
|
||||
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="2" class="p-2 border border-gray-200 text-center">No Documents!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="p-2 border border-gray-200 text-center">No Documents!</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</table>
|
||||
</div>
|
||||
@@ -57,4 +57,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
</x-app-layout>
|
||||
|
||||
9
resources/views/documents/optionChild.blade.php
Normal file
9
resources/views/documents/optionChild.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@foreach ($childs as $child)
|
||||
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
|
||||
@if (count($child->childs))
|
||||
@include('documents.optionChild', [
|
||||
'childs' => $child->childs,
|
||||
'level' => $level + 1,
|
||||
])
|
||||
@endif
|
||||
@endforeach
|
||||
14
resources/views/documents/optionChildSelected.blade.php
Normal file
14
resources/views/documents/optionChildSelected.blade.php
Normal file
@@ -0,0 +1,14 @@
|
||||
@foreach ($childs as $child)
|
||||
@if ($parent_id == $child->id)
|
||||
<option value="{{ $child->id }}" selected>{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
|
||||
@else
|
||||
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
|
||||
@endif
|
||||
@if (count($child->childs))
|
||||
@include('documents.optionChildSelected', [
|
||||
'childs' => $child->childs,
|
||||
'parent_id' => $document->parent_id,
|
||||
'level' => $level + 1,
|
||||
])
|
||||
@endif
|
||||
@endforeach
|
||||
16
resources/views/documents/tableChild.blade.php
Normal file
16
resources/views/documents/tableChild.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@foreach ($childs as $child)
|
||||
<tr>
|
||||
<td class="p-2 border border-gray-200">
|
||||
{{ str_pad('', $level, '-') . ' ' . $child->name }}
|
||||
</td>
|
||||
<td class="p-2 border border-gray-200">
|
||||
@include('documents.actions', ['document' => $child])
|
||||
</td>
|
||||
</tr>
|
||||
@if (count($child->childs))
|
||||
@include('documents.tableChild', [
|
||||
'childs' => $child->childs,
|
||||
'level' => $level + 1,
|
||||
])
|
||||
@endif
|
||||
@endforeach
|
||||
@@ -37,8 +37,8 @@ Route::prefix('admin')->middleware(['admin'])->group(function () {
|
||||
Route::resource('/projects', ProjectController::class)->middleware(['auth']);
|
||||
Route::post('/project/{project}/select',SelectProjectController::class)->middleware(['auth'])->name('project.select');
|
||||
|
||||
Route::resource('/mmc', MMCController::class);
|
||||
Route::resource('/documents', DocumentController::class);
|
||||
Route::resource('/auk', AUKController::class);
|
||||
Route::resource('/mmc', MMCController::class)->middleware(['auth']);
|
||||
Route::resource('/documents', DocumentController::class)->middleware(['auth']);
|
||||
Route::resource('/auk', AUKController::class)->middleware(['auth']);
|
||||
|
||||
require __DIR__ . '/auth.php';
|
||||
|
||||
Reference in New Issue
Block a user