-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Можно добавлять понятия, добавил измениние title в зависимости от стр…
…аницы
- Loading branch information
Showing
24 changed files
with
353 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Models\Concept; | ||
use App\Models\Dictionary; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Validation\Rule; | ||
|
||
class ConceptController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
*/ | ||
public function index() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
*/ | ||
public function create(Dictionary $dictionary) | ||
{ | ||
|
||
if($dictionary->fk_user_id != auth()->user()->id) { | ||
return abort(404); | ||
} | ||
if (request()->get('parentId') == null) { | ||
return view('concept.create', compact('dictionary')); | ||
} | ||
|
||
$parent = Concept::findOrFail(request()->get('parentId')); | ||
return view('concept.create', compact('dictionary', 'parent')); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
*/ | ||
public function store(Request $request, string $dictionaryId) | ||
{ | ||
$request->validate([ | ||
'name' => ['required', 'max:50', Rule::notIn(Dictionary::find($dictionaryId)->concepts()->pluck('name'))], | ||
'description' => 'max:500', | ||
'fk_parent_concept_id' => ['uuid',Rule::in(Dictionary::find($dictionaryId)->concepts()->pluck('id'))], | ||
]); | ||
|
||
$concept = new Concept([ | ||
'name' => $request->name, | ||
'definition' => $request->definition, | ||
'fk_dictionary_id' => $dictionaryId, | ||
'fk_parent_concept_id' => $request->fk_parent_concept_id, | ||
]); | ||
|
||
$concept->saveOrFail(); | ||
|
||
return redirect()->route('dictionary.show', $dictionaryId); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
*/ | ||
public function show(Concept $concept) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
*/ | ||
public function edit(Concept $concept) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
*/ | ||
public function update(Request $request, Concept $concept) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
*/ | ||
public function destroy(Request $request,string $id) | ||
{ | ||
dd($request); | ||
$concept = Concept::findOrFail($id); | ||
$dict = $concept->fk_dictionary_id; | ||
|
||
$concept->delete(); | ||
$concept->saveOrFail(); | ||
|
||
return redirect(route('dictionary.show'), $dict); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
resources/views/components/dashboard/sidebar/menu.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="inline-flex rounded-md shadow-sm" role="group"> | ||
<a href="{{route('concept.create', ['dictionary' =>$dictionary])}}" class="inline-flex items-center px-2 py-1 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"> | ||
<svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> | ||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 7.757v8.486M7.757 12h8.486M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /> | ||
</svg> | ||
</a> | ||
|
||
<button type="button" class="inline-flex items-center px-2 py-1 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"> | ||
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"> | ||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12.25V1m0 11.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M4 19v-2.25m6-13.5V1m0 2.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M10 19V7.75m6 4.5V1m0 11.25a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM16 19v-2" /> | ||
</svg> | ||
</button> | ||
<button type="button" class="inline-flex items-center px-2 py-1 text-sm font-medium text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"> | ||
<svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> | ||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7.757 12h8.486M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /> | ||
</svg> | ||
</button> | ||
<button type="button" class="inline-flex items-center px-2 py-1 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-e-lg hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white"> | ||
<svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> | ||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 10V4a1 1 0 0 0-1-1H9.914a1 1 0 0 0-.707.293L5.293 7.207A1 1 0 0 0 5 7.914V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2M10 3v4a1 1 0 0 1-1 1H5m5 6h9m0 0-2-2m2 2-2 2" /> | ||
</svg> | ||
</button> | ||
<!-- concept delete --> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
resources/views/components/dashboard/sidebar/sidebar.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<aside class="mt-2 items-center border-r w-64 dark:border-gray-600 border-gray-200 pr-4"> | ||
<div class="flex justify-center mb-2"> | ||
@include('components.dashboard.sidebar.menu') | ||
</div> | ||
<div class="mt-1 text-sm text-black max-h-lvh overflow-scroll" id="concept-tree"> | ||
@includeWhen($concepts, 'components.tree-view.tree-view') | ||
</div> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!-- Управление словарем --> | ||
@props(['dictionary', 'concepts']) | ||
|
||
@php | ||
session()->push('dictionary', $dictionary); | ||
@endphp | ||
|
||
<x-layout.main> | ||
<x-slot:title>{{ $dictionary->name }}</x-slot:title> | ||
<x-slot name="navigation"></x-slot> | ||
<div class="flex flex-row px-4"> | ||
@include('components.dashboard.sidebar.sidebar') | ||
<section class="flex-grow-10 pl-4 pr-4"> | ||
<div class="mb-4 border-b border-gray-200 dark:border-gray-700"> | ||
<ul class="flex flex-wrap -mb-px text-sm font-medium text-center" id="default-tab" data-tabs-toggle="#default-tab-content" role="tablist"> | ||
<li class="me-2" role="presentation"> | ||
<button class="inline-block p-4 border-b-2 rounded-t-lg" id="dictionaryionary-tab" data-tabs-target="#dictionaryionary" type="button" role="tab" aria-controls="dictionaryionary" aria-selected="false">dictionaryionary</button> | ||
</li> | ||
<li class="me-2" role="presentation"> | ||
<button class="inline-block p-4 border-b-2 rounded-t-lg hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300" id="concept-tab" data-tabs-target="#concept" type="button" role="tab" aria-controls="concept" aria-selected="false">{{ __('Понятия')}}</button> | ||
</li> | ||
<li class="me-2" role="presentation"> | ||
<button class="inline-block p-4 border-b-2 rounded-t-lg hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300" id="settings-tab" data-tabs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button> | ||
</li> | ||
<li role="presentation"> | ||
<button class="inline-block p-4 border-b-2 rounded-t-lg hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300" id="export-tab" data-tabs-target="#export" type="button" role="tab" aria-controls="export" aria-selected="false">{{ __('Экспорт')}}</button> | ||
</li> | ||
</ul> | ||
</div> | ||
<div id="default-tab-content"> | ||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="dictionaryionary" role="tabpanel" aria-labelledby="dictionaryionary-tab"> | ||
<p class="text-sm text-gray-500 dark:text-gray-400">This is some placeholder content the <strong class="font-medium text-gray-800 dark:text-white">dictionaryionary tab's associated content</strong>. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.</p> | ||
</div> | ||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="concept" role="tabpanel" aria-labelledby="concept-tab"> | ||
<p class="text-sm text-gray-500 dark:text-gray-400">This is some placeholder content the <strong class="font-medium text-gray-800 dark:text-white">concept tab's associated content</strong>. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling.</p> | ||
</div> | ||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="settings" role="tabpanel" aria-labelledby="settings-tab"> | ||
<p class="text-sm text-gray-500 dark:text-gray-400">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iure doloremque vero recusandae reprehenderit rem voluptates quas sint possimus nostrum at, facilis quisquam dignissimos. Modi illum velit assumenda vitae dictionarya! Illo.</p> | ||
</div> | ||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="export" role="tabpanel" aria-labelledby="export-tab"> | ||
<p class="text-sm text-gray-500 dark:text-gray-400"> | ||
Здесь будет экспорт списка понятий... | ||
</p> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
</x-layout.main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<x-layout.main> | ||
<x-slot:title>{{ __('Главная') }}</x-slot:title> | ||
<x-slot name="navigation"></x-slot> | ||
</x-layout.main> |
Oops, something went wrong.