update create AUK

This commit is contained in:
Александр Бабкин
2022-07-13 08:22:31 +03:00
parent 0cd5e9741f
commit fa2df0f944
5 changed files with 31 additions and 15 deletions

View File

@@ -47,16 +47,18 @@ class AUKController extends Controller
{ {
$project_id = $request->session()->get('project_id'); $project_id = $request->session()->get('project_id');
$request->validate([ $request->validate([
'name' => ['required', 'string', 'max:255'], 'auk_name' => ['required', 'string', 'max:255'],
'number' => ['required', 'integer'], 'auk_path' => ['required', 'string', 'max:255'],
'image_dir' => ['required', 'string', 'max:255'],
'parent_id' => ['required', 'integer'], 'parent_id' => ['required', 'integer'],
]); ]);
// $user = // $user =
AUK::create([ AUK::create([
'project_id' => $project_id, 'project_id' => $project_id,
'name' => $request->name, 'auk_name' => $request->auk_name,
'number' => $request->number, 'auk_path' => $request->auk_path,
'image_dir' => $request->image_dir,
'parent_id' => $request->parent_id, 'parent_id' => $request->parent_id,
]); ]);

View File

@@ -23,17 +23,24 @@
@csrf @csrf
<!-- Document name --> <!-- Document name -->
<div> <div>
<x-label for="name" :value="__('Title')" /> <x-label for="auk_name" :value="__('Title')" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name" <x-input id="auk_name" class="block mt-1 w-full" type="text" name="auk_name"
:value="old('name')" required autofocus /> :value="old('auk_name')" required autofocus />
</div> </div>
<div> <div>
<x-label for="number" :value="__('Number')" /> <x-label for="auk_path" :value="__('Path')" />
<x-input id="number" class="block mt-1 w-full" type="text" name="number" <x-input id="auk_path" class="block mt-1 w-full" type="text" name="auk_path"
:value="old('number')" required /> :value="old('auk_path')" required />
</div>
<div>
<x-label for="image_dir" :value="__('Image Dir')" />
<x-input id="image_dir" class="block mt-1 w-full" type="text" name="image_dir"
:value="old('image_dir')" required />
</div> </div>
<div> <div>
@@ -42,7 +49,7 @@
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required> <x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
<option value="0">---</option> <option value="0">---</option>
@foreach ($top_auks as $auks) @foreach ($top_auks as $auks)
<option value="{{ $auks->id }}">{{ $auks->name }} ({{ $auks->number }})</option> <option value="{{ $auks->id }}">{{ $auks->auk_name }} ({{ $auks->auk_path }})</option>
@if (count($auks->childs)) @if (count($auks->childs))
@include('auks.optionChild', [ @include('auks.optionChild', [
'childs' => $auks->childs, 'childs' => $auks->childs,

View File

@@ -37,6 +37,9 @@
<th class="p-2 border border-gray-200"> <th class="p-2 border border-gray-200">
{{ __('Path') }} {{ __('Path') }}
</th> </th>
<th class="p-2 border border-gray-200">
{{ __('Image Dir') }}
</th>
<th class="p-2 border border-gray-200"> <th class="p-2 border border-gray-200">
{{ __('Actions') }} {{ __('Actions') }}
</th> </th>
@@ -45,6 +48,7 @@
<tr class="border border-gray-200"> <tr class="border border-gray-200">
<td class="p-2 border border-gray-200">{{ $top_auk->auk_name }}</td> <td class="p-2 border border-gray-200">{{ $top_auk->auk_name }}</td>
<td class="p-2 border border-gray-200">{{ $top_auk->auk_path }}</td> <td class="p-2 border border-gray-200">{{ $top_auk->auk_path }}</td>
<td class="p-2 border border-gray-200">{{ $top_auk->image_dir }}</td>
<td class="p-2 border border-gray-200"> <td class="p-2 border border-gray-200">
<div class="text-center"> <div class="text-center">
@include('auks.actions', ['auk' => $top_auk]) @include('auks.actions', ['auk' => $top_auk])
@@ -65,7 +69,7 @@
@empty @empty
<tr> <tr>
<td colspan="3" class="p-2 border border-gray-200 text-center">No AUKs!</td> <td colspan="4" class="p-2 border border-gray-200 text-center">No AUKs!</td>
</tr> </tr>
@endforelse @endforelse
</table> </table>

View File

@@ -1,5 +1,5 @@
@foreach ($childs as $child) @foreach ($childs as $child)
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->name }}</option> <option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->auk_name }} ({{ $child->auk_path }})</option>
@if (count($child->childs)) @if (count($child->childs))
@include('documents.optionChild', [ @include('documents.optionChild', [
'childs' => $child->childs, 'childs' => $child->childs,

View File

@@ -1,10 +1,13 @@
@foreach ($childs as $child) @foreach ($childs as $child)
<tr> <tr>
<td class="p-2 border border-gray-200"> <td class="p-2 border border-gray-200">
{{ str_pad('', $level, '-') . ' ' . $child->name }} {{ str_pad('', $level, '-') . ' ' . $child->auk_name }}
</td> </td>
<td class="p-2 border border-gray-200"> <td class="p-2 border border-gray-200">
{{ $child->number }} {{ $child->auk_path }}
</td>
<td class="p-2 border border-gray-200">
{{ $child->image_dir }}
</td> </td>
<td class="p-2 border border-gray-200"> <td class="p-2 border border-gray-200">
@include('auks.actions', ['auk' => $child]) @include('auks.actions', ['auk' => $child])